Files
cbd420/api-doc/create-payment.MD
2025-12-21 08:43:43 +01:00

5.3 KiB
Raw Blame History

POSTCreate payment https://api.nowpayments.io/v1/payment

Creates payment. With this method, your customer will be able to complete the payment without leaving your website.

Be sure to consider the details of repeated and wrong-asset deposits from 'Repeated Deposits and Wrong-Asset Deposits' section when processing payments.

Data must be sent as a JSON-object payload. Required request fields:

price_amount (required) - the fiat equivalent of the price to be paid in crypto. If the pay_amount parameter is left empty, our system will automatically convert this fiat price into its crypto equivalent. Please note that this does not enable fiat payments, only provides a fiat price for yours and the customers convenience and information. NOTE: Some of the assets (KISHU, NWC, FTT, CHR, XYM, SRK, KLV, SUPER, OM, XCUR, NOW, SHIB, SAND, MATIC, CTSI, MANA, FRONT, FTM, DAO, LGCY), have a maximum price amount of ~$2000;

price_currency (required) - the fiat currency in which the price_amount is specified (usd, eur, etc);

pay_amount (optional) - the amount that users have to pay for the order stated in crypto. You can either specify it yourself, or we will automatically convert the amount you indicated in price_amount;

pay_currency (required) - the crypto currency in which the pay_amount is specified (btc, eth, etc), or one of available fiat currencies if it's enabled for your account (USD, EUR, ILS, GBP, AUD, RON);
NOTE: some of the currencies require a Memo, Destination Tag, etc., to complete a payment (AVA, EOS, BNBMAINNET, XLM, XRP). This is unique for each payment. This ID is received in “payin_extra_id” parameter of the response. Payments made without "payin_extra_id" cannot be detected automatically;

ipn_callback_url (optional) - url to receive callbacks, should contain "http" or "https", eg. "https://nowpayments.io";

order_id (optional) - inner store order ID, e.g. "RGDBP-21314";

order_description (optional) - inner store order description, e.g. "Apple Macbook Pro 2019 x 1";

payout_address (optional) - usually the funds will go to the address you specify in your Personal account. In case you want to receive funds on another address, you can specify it in this parameter;

payout_currency (optional) - currency of your external payout_address, required when payout_adress is specified;

payout_extra_id(optional) - extra id or memo or tag for external payout_address;

is_fixed_rate(optional) - boolean, can be true or false. Required for fixed-rate exchanges;
NOTE: the rate of exchange will be frozen for 20 minutes. If there are no incoming payments during this period, the payment status changes to "expired".

is_fee_paid_by_user(optional) - boolean, can be true or false. Required for fixed-rate exchanges with all fees paid by users;
NOTE: the rate of exchange will be frozen for 20 minutes. If there are no incoming payments during this period, the payment status changes to "expired". The fee paid by user payment can be only fixed rate. If you disable fixed rate during payment creation process, this flag would enforce fixed_rate to be true;

Here the list of available statuses of payment:

waiting - waiting for the customer to send the payment. The initial status of each payment;

confirming - the transaction is being processed on the blockchain. Appears when NOWPayments detect the funds from the user on the blockchain;
Please note: each currency has its own amount of confirmations required to start the processing.

confirmed - the process is confirmed by the blockchain. Customers funds have accumulated enough confirmations;

sending - the funds are being sent to your personal wallet. We are in the process of sending the funds to you;

partially_paid - it shows that the customer sent less than the actual price. Appears when the funds have arrived in your wallet;

finished - the funds have reached your personal address and the payment is finished;

failed - the payment wasn't completed due to the error of some kind;

expired - the user didn't send the funds to the specified address in the 7 days time window;

Please note: when you're creating a fiat2crypto payment you also should include additional header to your request - "origin-ip : xxx", where xxx is your customer IP address.

Request Example: curl --location 'https://api.nowpayments.io/v1/payment'
--header 'x-api-key: {{api-key}}'
--header 'Content-Type: application/json'
--data '{ "price_amount": 3999.5, "price_currency": "usd", "pay_currency": "btc", "ipn_callback_url": "https://nowpayments.io", "order_id": "RGDBP-21314", "order_description": "Apple Macbook Pro 2019 x 1" }'

Response: { "payment_id": "5745459419", "payment_status": "waiting", "pay_address": "3EZ2uTdVDAMFXTfc6uLDDKR6o8qKBZXVkj", "price_amount": 3999.5, "price_currency": "usd", "pay_amount": 0.17070286, "pay_currency": "btc", "order_id": "RGDBP-21314", "order_description": "Apple Macbook Pro 2019 x 1", "ipn_callback_url": "https://nowpayments.io", "created_at": "2020-12-22T15:00:22.742Z", "updated_at": "2020-12-22T15:00:22.742Z", "purchase_id": "5837122679", "amount_received": null, "payin_extra_id": null, "smart_contract": "", "network": "btc", "network_precision": 8, "time_limit": null, "burning_percent": null, "expiration_estimate_date": "2020-12-23T15:00:22.742Z" }