Payment Intent API
Last updated
Last updated
The Payment Intent API allows users to purchase crypto using fiat currency (e.g., buy USDT by paying in EUR). Payments are made either via credit card or bank transfer.
Once the payment is completed, the purchased crypto is sent to the wallet specified during order registration.
The API also supports KYC verification for new users if required.
This method allow to register a new payment intent.
A Payment Intent records a user's intent to purchase a specified amount of crypto and pay for it using fiat. Either the crypto amount or the fiat amount is defined during the creation of the Payment Intent.
For example, if a user wants to buy €1000 worth of BTC, the system will automatically calculate the corresponding BTC amount. Similarly, if the user wants to purchase 0.01 BTC, the system will determine the required fiat amount to complete the purchase.
Therefore, it is not necessary to provide both values. If both the crypto and fiat amounts are sent via the API, the system will prioritize the fiat amount and recalculate the crypto amount accordingly.
The fiat or crypto amounts calculated by the system can be retrieved through the payment instructions API call. This allows users to review and confirm the final amounts before proceeding with the payment.
If the user is required to complete the KYC process before purchasing crypto, this API call will return a URL where they can complete the verification. Additionally, a callback URL can be specified so that, once the KYC process is successfully completed, the user is redirected back to continue the purchase process.
It is important to note that the IP address is part of the information sent when calling the API, and it must be the user's actual IP. Payment gateways require this data to verify the authenticity of the transaction.
Additionally, any data provided — such as the country — must be accurate and not inferred from other data points. If the actual value is unknown, it should be omitted.
Optionally, we can specify an IPN URL to receive asynchronous notifications whenever the payment status changes—for example, when a user pays for an order or when the cryptocurrencies are sent to the user.
The IPN Url will be called via GET with 2 parameters:
paymentIntentId: The ID of the payment intent
paymentIntentStatus: The status of the payment intent (see the to see all possible values)
The API call will return three values:
A Payment Intent ID to reference in subsequent API calls.
A KYC URL (if required) where the user can complete the verification process.
To call the API, it is essential to include the x-api-key
header.
Additionally, the storeId
value, which is unique per client, must be specified for the API request to function correctly.
Both values are provided by AhoraCrypto.
To call this API, it is essential to include the x-api-key
header.
We can retrieve the payment instructions by calling the following method:
At any time, we can check the status of a payment using this call.
Posible values are:
1
Initial state when payment intent is created but not yet processed
2
Waiting for user to complete KYC (Know Your Customer) verification. User can't pay and order can't be processed until the user has passed the KYC
3
Pending to pass a manual KYC verification. User has upload its documents to KYC center, but still need to be verified manually by AhoraCrypto. User can't pay and order can't be processed until the user has passed the KYC
4
Ready to pay, as all previous requirements (including KYC verification) have been fulfilled.
5
Payment has been received but order is still pending to be processed
6
Order has been processed successfully
10
Payment intent has timed out and is no longer valid
12
Payment was made but has been refunded to the user
14
Payment intent was cancelled before completion
10000
General failure in payment / order processing
10001
User failed to pass KYC verification requirements
10002
The user belongs to a country that AhoraCrypto does not operated in.
It also returns an order number associated with the given payment intent ID, if it exists. Orders are created once the user has passed KYC validation and is able to pay for the order.
To call the API, it is essential to include the x-api-key
header.
We can retrieve the payment instructions by calling the following method:
A status (see the to see all possible values). However, we can only retrieve payment instructions if the status is 4
(Ready to Pay)
Once the Payment Intent has been registered and the payment is ready (i.e. because the payment status was 4
Ready for Payment), we can get the payment instructions. Note that we can't call this endpoint while payment status is not ready (e.g. if the user is pending for a KYC validation). We can check the status of a payment intent by calling the at any time.
API key for authentication
API key for authentication
Country calling code (e.g., +1, +44)
User phone number without country code
User email address
Fiat currency code (e.g., USD, EUR)
Cryptocurrency symbol (e.g., USDT, BTC)
User IP address
Cryptocurrency wallet address
Blockchain network for the transaction
Unique identifier assigned by the API provider. Contact support to get your store ID.
ISO country code (2 characters, e.g., ES for Spain, US for United States, ...)
Amount in cryptocurrency to be received. If not specified, the fiat amount will be used to calculate the crypto amount.
Amount in fiat currency to be paid. If not specified, the crypto amount will be used to calculate the necessary fiat amount to be paid.
URL to redirect the user after KYC verification is done in case the user has to pass the KYC verification
URL to redirect the user after payment has been completed. Note that it does not mean that the payment has been successful, it means that the payment process has been completed. You should check the payment status via the GET /payment/intent/{id}/status endpoint.
URL to redirect the user if they cancel the payment process
URL where payment status notifications (IPN) will be sent. Payment status can be also retrieved via the GET /payment/intent/{id}/status endpoint.
User first name
User last name
Type of identification document
Identification document number
User birth date in YYYY-MM-DD format
ISO country code of document issuance (2 characters, e.g., ES for Spain, US for United States, ...)
ISO country code for nationality (2 characters, e.g., ES for Spain, US for United States, ...)
URL of KYC verification video
URL of identification document front image
URL of identification document back image