AhoraCrypto
  • Welcome
  • API
    • Payment Intent API
  • Exchange API
  • Networks
  • WIDGET
    • Web Widget
  • React SDK
Powered by GitBook
On this page
  1. API

Payment Intent API

PreviousWelcomeNextExchange API

Last updated 4 days ago

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.

Create a new Payment Intent

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.

It is important to use the network symbol shown in the as the value for the network field.

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.

IPN Url and Payment Intent Status

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

Return Value

The API call will return three values:

  1. A Payment Intent ID to reference in subsequent API calls.

  2. 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.

Get Payment Instructions

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:

Get Payment Intent

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:

Get Payment Status

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.

Networks page
Networks page
payment status section
payment status section
Payment Intent Status endpoint
get
Path parameters
idstringRequired
Responses
200
Get the payment intents current status
application/json
401
Unauthorized - Missing or invalid API key
404
Order not found
500
Internal Server Error
get
GET /payment/intent/{id}/status HTTP/1.1
Host: api.ahoracrypto.com
Accept: */*
{
  "status": 1,
  "orderNumber": "text"
}
get
Path parameters
idstringRequired
Header parameters
x-api-keystringRequired

API key for authentication

Responses
200
Get payment instructions
application/json
401
Unauthorized
403
Forbidden - KYC Required
404
Not Found
500
Internal Server Error
get
GET /payment/intent/{id}/instructions HTTP/1.1
Host: api.ahoracrypto.com
x-api-key: text
Accept: */*
{
  "iban": "text",
  "bic": "text",
  "accountHolder": "text",
  "bankCountry": "text",
  "reference": "text",
  "fiatAmount": 1,
  "fiatCurrency": "text",
  "cryptoAmount": 1,
  "cryptoCurrency": "text",
  "walletAddress": "text",
  "network": "text",
  "creditCardPaymentUrl": "https://example.com",
  "choosePaymentMethodsUrl": "https://example.com"
}
get
Path parameters
orderNumberstringRequired
Header parameters
x-api-keystringRequired

API key for authentication

Responses
200
Get payment intent by order number
application/json
401
Unauthorized - Missing or invalid API key
404
Payment intent not found
500
Internal Server Error
get
GET /payment/intent/order/{orderNumber} HTTP/1.1
Host: api.ahoracrypto.com
x-api-key: text
Accept: */*
{
  "id": "text",
  "status": 1,
  "kycUrl": "text"
}
  • Create a new Payment Intent
  • POST/payment/intent
  • Get Payment Instructions
  • GET/payment/intent/{id}/instructions
  • Get Payment Intent
  • GET/payment/intent/order/{orderNumber}
  • Get Payment Status
  • GET/payment/intent/{id}/status
post
Header parameters
x-api-keystringRequired

API key for authentication

Body
emailstringRequired

User email address

fiatCurrencystringRequired

Fiat currency code (e.g., USD, EUR)

cryptoSymbolstringRequired

Cryptocurrency symbol (e.g., USDT, BTC)

ipAddressstringRequired

User IP address

walletAddressstringRequired

Cryptocurrency wallet address

networkstringRequired

Blockchain network for the transaction

storeIdstringRequired

Unique identifier assigned by the API provider. Contact support to get your store ID.

countrystringOptional

ISO country code (2 characters, e.g., ES for Spain, US for United States, ...)

phonePrefixstringOptional

Country calling code (e.g., +1, +44)

phoneNumberstringOptional

User phone number without country code

cryptoAmountnumberOptional

Amount in cryptocurrency to be received. If not specified, the fiat amount will be used to calculate the crypto amount.

fiatAmountnumberOptional

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.

kycCallbackUrlstringOptional

URL to redirect the user after KYC verification is done in case the user has to pass the KYC verification

paymentCallbackUrlstringOptional

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.

cancellationCallbackUrlstringOptional

URL to redirect the user if they cancel the payment process

ipnUrlstringOptional

URL where payment status notifications (IPN) will be sent. Payment status can be also retrieved via the GET /payment/intent/{id}/status endpoint.

firstNamestringOptional

User first name

lastNamestringOptional

User last name

documentTypenumberOptional

Type of identification document

documentNumberstringOptional

Identification document number

birthDatestringOptional

User birth date in YYYY-MM-DD format

documentIssuedCountrystringOptional

ISO country code of document issuance (2 characters, e.g., ES for Spain, US for United States, ...)

nationalitystringOptional

ISO country code for nationality (2 characters, e.g., ES for Spain, US for United States, ...)

kycVideoUrlstringOptional

URL of KYC verification video

documentFrontUrlstringOptional

URL of identification document front image

documentBackUrlstringOptional

URL of identification document back image

Responses
200
Create payment intent
application/json
400
Bad request - Missing required fields or invalid values
401
Unauthorized - Missing or invalid API key
500
Internal Server Error
post
POST /payment/intent HTTP/1.1
Host: api.ahoracrypto.com
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 549

{
  "email": "text",
  "fiatCurrency": "text",
  "cryptoSymbol": "text",
  "ipAddress": "text",
  "walletAddress": "text",
  "network": "text",
  "storeId": "text",
  "country": "text",
  "phonePrefix": "text",
  "phoneNumber": "text",
  "cryptoAmount": 1,
  "fiatAmount": 1,
  "kycCallbackUrl": "text",
  "paymentCallbackUrl": "text",
  "cancellationCallbackUrl": "text",
  "ipnUrl": "text",
  "firstName": "text",
  "lastName": "text",
  "documentType": 1,
  "documentNumber": "text",
  "birthDate": "text",
  "documentIssuedCountry": "text",
  "nationality": "text",
  "kycVideoUrl": "text",
  "documentFrontUrl": "text",
  "documentBackUrl": "text"
}
{
  "id": "text",
  "status": 1,
  "kycUrl": "text"
}