NowgateDocs

Payments

Create, retrieve and list payments.

On this page

Create a payment#

POST/v1/paymentsAPI key, payments scope

Issues a deposit address (and, on Stellar, a memo) for one network-asset pair and an expected amount. Show the address to your customer; the payment moves to finished once the funds are confirmed.

Price the payment in the asset (amount) or in a currency (price_amount and price_currency), never both. A fiat price is converted once, at creation, with Nowgate's own rates, and the converted amount holds for the payment's window: 20 minutes by default, at most an hour. When no rate can be had right now, the request fails with rate_unavailable (503) and can be retried.

await nowgate.payments.create({ … });

Headers

  • Idempotency-Keystringrequired

    A unique key for this request, such as a UUID: 1-255 visible ASCII characters, without spaces. Retrying with the same key and the same request replays the original response (for at least 24 hours); the same key with a different request is refused with 422 idempotency_key_reused. Failed requests are not stored, so they can be retried with the same key.

    1 to 255 characters. Pattern: ^[!-~]+$.

Body

  • networkNetwork (string)required

    Network identifier; see GET /assets. New networks may be added.

  • assetAssetSymbol (string)required

    Asset symbol on the network; see GET /assets.

  • amountAmount (string)

    The price in the asset. Give this or price_amount, not both.

  • price_amountFiatAmount (string)

    The price in price_currency, converted at creation. Give this or amount, not both.

  • price_currencystring

    The currency of price_amount. USD or EUR.

    Example: "USD".

  • markup_bpsinteger

    Added to a fiat price's converted amount, in basis points, for example to cover volatility.

    From 0 to 1000.

  • fee_paid_byFeePaidBy (string)

    Who bears Nowgate's fee. With payer, the payer sends enough for you to receive the whole price after the fee. The default is merchant.

    One of: merchant, payer.

  • order_idstring

    Your reference for this payment.

    At most 255 characters.

  • descriptionstring

    At most 1000 characters.

  • expires_ininteger

    Seconds until the payment expires (default: your account setting, usually 3600; for a fiat price, 1200, and at most 3600).

    From 900 to 86400.

  • metadatamap of string

    At most 20 keys.

  • webhook_urlstring

    Where this payment's events go, instead of to your webhook endpoints: an https URL without credentials or a fragment. Deliveries are signed with your default endpoint's secret, so you verify them as you verify every other delivery; without a default endpoint the field is refused.

    At most 2048 characters. Example: "https://shop.example/orders/1042/webhook".

Responses

201 The payment was created.

Returns The Payment object.

  • Location: URL of the new payment.
  • Idempotent-Replayed: Present and true when this is a stored response for a repeated request.
  • Original-Request-Id: On a replayed response, the ID of the request that created it.

4xx, 5xx An error, as problem details.

Retrieve a payment#

GET/v1/payments/{id}API key, read scope
await nowgate.payments.retrieve(id);

Path parameters

  • idPaymentID (string)required

Responses

200 The payment.

Returns The Payment object.

4xx, 5xx An error, as problem details.

List payments#

GET/v1/paymentsAPI key, read scope
await nowgate.payments.list({ … });
for await (const item of nowgate.payments.listAll({ … })) { … }

Query parameters

  • limitinteger

    From 1 to 100. Default: 20.

  • starting_afterPaymentID (string)

    Return the page after (older than) this ID.

  • ending_beforePaymentID (string)

    Return the page before (newer than) this ID.

  • statusPaymentStatus (string)

    One of: waiting, confirming, partially_paid, finished, expired, failed, refunded.

  • order_idstring

    At most 255 characters.

Responses

200 A page of payments, newest first.

The PaymentList object
  • object"list"required
  • dataarray of Payment (object)required

    The Payment object

  • has_morebooleanrequired

4xx, 5xx An error, as problem details.

The payment object#

  • idPaymentID (string)required
  • object"payment"required
  • statusPaymentStatus (string)required

    One of: waiting, confirming, partially_paid, finished, expired, failed, refunded.

  • networkNetwork (string)required

    Network identifier; see GET /assets. New networks may be added.

  • assetAssetSymbol (string)required

    Asset symbol on the network; see GET /assets.

  • amountAmount (string)required

    A non-negative decimal amount in the asset's units, e.g. "12.5".

  • amount_receivedAmount (string)required

    Confirmed so far.

  • amount_pendingAmount (string)required

    Seen on-chain, not yet confirmed.

  • amount_creditedAmount (string)required

    Credited to your balance (before fees).

  • amount_refundedAmount (string)required

    What finished refunds returned to the payer, in the payment's asset.

  • refund_pendingAmount (string)required

    What refunds under way will return to the payer.

  • feeAmount (string)required

    Nowgate's fee on the credited amount.

  • fee_paid_byFeePaidBy (string)required

    Who bears Nowgate's fee. With payer, the payer sends enough for you to receive the whole price after the fee. The default is merchant.

    One of: merchant, payer.

  • pricePrice (object)

    Present when the payment is priced in a currency.

    2 fields of Price
    • amountFiatAmount (string)required

      An amount of a currency with at most two decimal places, e.g. "25.00".

    • currencystringrequired

      Example: "USD".

  • quoteQuote (object)

    Present when the payment is priced in a currency.

    4 fields of Quote
    • ratestringrequired

      The currency's price of one whole unit of the asset, as a decimal.

      Example: "2232.05".

    • currencystringrequired

      Example: "USD".

    • rate_atTimestamp (string (date-time))required

      When the rate was measured.

    • markup_bpsintegerrequired
  • subscriptionSubscriptionID (string)

    The subscription whose invoice this payment pays.

  • invoiceInvoiceID (string)

    The invoice this payment pays (one of its attempts).

  • payment_linkPaymentLinkID (string)

    Present on an attempt on a payment link.

  • checkout_urlstring

    The payment's hosted checkout page, to send your customer to. Its token is a capability for that page alone: anyone with the URL can see the payment's checkout, and nothing else.

  • donorDonor (object)

    Present on a donation whose donor left a name or a message, or gave anonymously.

    3 fields of Donor
    • namestring

      Absent when the donor gave anonymously.

    • messagestring
    • anonymousbooleanrequired
  • amount_countedAmount (string)

    Present when the payment is priced in a currency: what the confirmed funds count for against amount. Funds that arrive after the payment expired are valued again at the rate when Nowgate first saw them, so they can count for more or less than they are. Your balance is always credited with every unit that arrived.

  • repricing_unavailableboolean

    Present when the payment is priced in a currency: true when funds arrived after expiry at a moment with no rate to value them at. They count for nothing until you review the payment; your balance still holds them.

  • depositDeposit (object)required
    2 fields of Deposit
    • addressstringrequired
    • memostring

      Present on networks that identify deposits by memo (Stellar). The customer must include it.

  • latebooleanrequired

    Funds arrived after the payment expired.

  • overpaidbooleanrequired
  • reversedbooleanrequired

    A credit was reversed after a chain reorganization.

  • order_idstring
  • descriptionstring
  • metadatamap of stringrequired
  • expires_atTimestamp (string (date-time))required
  • closed_atTimestamp (string (date-time))
  • created_atTimestamp (string (date-time))required
  • updated_atTimestamp (string (date-time))required
  • versioninteger (int64)required

    Increases with every change; use it to ignore stale webhook events.