Payments
Create, retrieve and list payments.
On this page
Create a payment#
/v1/paymentsAPI key, payments scopeIssues 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({ … });client.payments.create(…)$nowgate->payments->create([…]);Headers
Idempotency-KeystringrequiredA 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)requiredNetwork identifier; see GET /assets. New networks may be added.
assetAssetSymbol (string)requiredAsset 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 oramount, not both.price_currencystringThe currency of
price_amount. USD or EUR.Example:
"USD".markup_bpsintegerAdded 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 ismerchant.One of:
merchant,payer.order_idstringYour reference for this payment.
At most 255 characters.
descriptionstringAt most 1000 characters.
expires_inintegerSeconds 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 stringAt most 20 keys.
webhook_urlstringWhere 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 andtruewhen 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#
/v1/payments/{id}API key, read scopeawait nowgate.payments.retrieve(id);client.payments.retrieve(id)$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#
/v1/paymentsAPI key, read scopeawait nowgate.payments.list({ … });
for await (const item of nowgate.payments.listAll({ … })) { … }client.payments.list(…)
for item in client.payments.list_all(…): …$nowgate->payments->list([…]);
foreach ($nowgate->payments->listAll([…]) as $item) { … }Query parameters
limitintegerFrom 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_idstringAt most 255 characters.
Responses
200 A page of payments, newest first.
The PaymentList object
object"list"requireddataarray of Payment (object)requiredhas_morebooleanrequired
4xx, 5xx An error, as problem details.
The payment object#
idPaymentID (string)requiredobject"payment"requiredstatusPaymentStatus (string)requiredOne of:
waiting,confirming,partially_paid,finished,expired,failed,refunded.networkNetwork (string)requiredNetwork identifier; see GET /assets. New networks may be added.
assetAssetSymbol (string)requiredAsset symbol on the network; see GET /assets.
amountAmount (string)requiredA non-negative decimal amount in the asset's units, e.g. "12.5".
amount_receivedAmount (string)requiredConfirmed so far.
amount_pendingAmount (string)requiredSeen on-chain, not yet confirmed.
amount_creditedAmount (string)requiredCredited to your balance (before fees).
amount_refundedAmount (string)requiredWhat finished refunds returned to the payer, in the payment's asset.
refund_pendingAmount (string)requiredWhat refunds under way will return to the payer.
feeAmount (string)requiredNowgate's fee on the credited amount.
fee_paid_byFeePaidBy (string)requiredWho bears Nowgate's fee. With
payer, the payer sends enough for you to receive the whole price after the fee. The default ismerchant.One of:
merchant,payer.pricePrice (object)Present when the payment is priced in a currency.
2 fields of Price
amountFiatAmount (string)requiredAn amount of a currency with at most two decimal places, e.g. "25.00".
currencystringrequiredExample:
"USD".
quoteQuote (object)Present when the payment is priced in a currency.
4 fields of Quote
ratestringrequiredThe currency's price of one whole unit of the asset, as a decimal.
Example:
"2232.05".currencystringrequiredExample:
"USD".rate_atTimestamp (string (date-time))requiredWhen 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_urlstringThe 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
namestringAbsent when the donor gave anonymously.
messagestringanonymousbooleanrequired
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_unavailablebooleanPresent 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)required2 fields of Deposit
addressstringrequiredmemostringPresent on networks that identify deposits by memo (Stellar). The customer must include it.
latebooleanrequiredFunds arrived after the payment expired.
overpaidbooleanrequiredreversedbooleanrequiredA credit was reversed after a chain reorganization.
order_idstringdescriptionstringmetadatamap of stringrequiredexpires_atTimestamp (string (date-time))requiredclosed_atTimestamp (string (date-time))created_atTimestamp (string (date-time))requiredupdated_atTimestamp (string (date-time))requiredversioninteger (int64)requiredIncreases with every change; use it to ignore stale webhook events.