Payment Intent API
Last updated
Last updated
The Payment Intent API enables users to purchase cryptocurrencies using fiat currencies (e.g., buying BTC with EUR). Supported payment methods include credit card, bank transfer, Apple Pay, and Google Pay.
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.
When specifying a cryptocurrency, it is also important to specify the network to which the crypto should be sent. In the , you can find a list of all supported networks.
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.
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
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:
This method allows you to retrieve information about an existing Payment Intent using its associated orderNumber
.
Once a Payment Intent has been created for an order, you can check its status at any time using this endpoint. This is useful to determine whether the payment is ready, if additional steps such as KYC verification are required, or simply to obtain the ID of the Payment Intent linked to the order.
The response includes:
The paymentIntentId
associated with the order.
The current status
of the Payment Intent.
If KYC is required, the kycUrl
the user must visit to complete the verification process.
To call this API, it is essential to include the x-api-key
header.
You can retrieve the Payment Intent information 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.
100
Payment was declined by the payment gateway. The order is still able to be paid in this status.
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:
paymentIntentStatus: The status of the payment intent (see the to see all possible values)
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
API key for authentication
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, ...)
Country calling code (e.g., +1, +44)
User phone number without country code
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