v1

latestOpenAPI 3.0.02026-07-265892227.1 KB
Payments

Create a PaymentIntent object

This endpoint is the first entry point of the PAY-IN circuit. First of all, you must create a payment intent which describes your intention to collect an amount of money in a currency. Later on, you will perform payments associated with this payment intent. Please do save the fields returned by this endpoint, especially the field 'id' and 'token'. That will help you identity the payment intent in our platform whenever you want to retrieve it.

post/payment-intents

Headers

ApiKeystring required

Your api key. To create a key, please get into our dashboard. If you don't have access to it, please reach the Support team.

MerchantIdstring required

Your merchant ID. This information is available in our dashboard. If you don't have access to it, please reach the Support team.

Environment'live' | 'sandbox' required

Allow you to choose between the sandbox mode to perform some tests or the live mode for real world transactions.

Request body

customerReferencestring required

This is a custom field you can fill with any reference you have on your side matching this payment intent. It can allow you to make a correspondence with this payment intent in your system. This field is specifically useful for customer's references, like your customer ID.

purchaseReferencestring required

This is a custom field you can fill with any reference you have on your side matching this payment intent. It can allow you to make a correspondence with this payment intent in your system. This field is specifically useful for purchase's references, like an order your customer made.

amountnumber required

Amount intended to be collected by this payment intent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge €1.00 or 100 to charge FCFA100, a zero-decimal currency).

currencystring required

Three-letter ISO currency code.

overrideBusinessNamestring

This field is mandatory for aggregators and allows you to override the business name displayed to the end users. This is useful if you don't want your clients to see "Hub2" as the target of their payment but your company name instead.

Example request

{
  "customerReference": "cust_01924059",
  "purchaseReference": "ref_2020_11_10_001",
  "amount": 100,
  "currency": "XOF",
  "overrideBusinessName": "My wonderful business"
}

Response

idstring required

Unique identifier for the PaymentIntent

merchantIdstring required

Identifier of the merchant owning this PaymentIntent

createdAtstring required

Datetime in UTC timezone at which this object was created. Follows the Datetime ISO.

updatedAtstring required

Datetime in UTC timezone at which this object was updated for the last time . Follows the Datetime ISO.

tokenstring required

A unique JSON Web Token allowing to attempt a Payment on the PaymentIntent on a client-side application.

purchaseReferencestring required

A reference provided by the client during the creation of this PaymentIntent

customerReferencestring required

A reference provided by the client during the creation of this PaymentIntent. It is a reference to the customer for who this PaymentIntent was created.

status'action_required' | 'canceled' | 'failed' | 'payment_required' | 'processing' | 'successful' required

The current status of this PaymentIntent

amountnumber required

Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge €1.00 or 100 to charge FCFA100, a zero-decimal currency).

currencystring required

Three-letter ISO currency code.

mode'live' | 'sandbox' required

Mode in which this PaymentIntent exists. The sandbox mode can be used during the integration phase and is available as soon as the merchant account is created. No real transactions are made in this mode. The live mode has to be used to make real transactions.

overrideBusinessNamestring

For Aggregator, name of the merchant

subMerchantIdstring

Submerchant ID

Example response

{
  "id": "pi_z1urYtVFgEebtcj8fxp4v",
  "createdAt": "2020-10-15T12:09:49.355Z",
  "updatedAt": "2020-10-15T12:16:26.128Z",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudElkIjoiMTYiLCJtb2RlIjoic2FuZGJveCIsInBheW1lbnRJZCI6InBpX3oxdXJZdFZGZ0VlYnRjajhmeHA0diIsImlhdCI6MTYwMjc1OTE4M30.OZ0fDnMVWvcT-gRthyBD58PFC20gabGKt1UPRe4aNi4",
  "purchaseReference": "ref_2020_11_10_001",
  "customerReference": "cust_01924059",
  "status": "successful",
  "amount": 100,
  "currency": "XOF",
  "payments": [
    {
      "id": "pay_QW2d6JnqiatcH8KhK0mD1",
      "intentId": "pi_z1urYtVFgEebtcj8fxp4v",
      "createdAt": "2020-10-15T12:09:49.355Z",
      "updatedAt": "2020-10-15T12:16:26.128Z",
      "status": "successful",
      "amount": 100,
      "currency": "XOF",
      "method": "credit_card",
      "country": "CI",
      "fees": [
        {
          "id": "lAe5HnFpvOjwdT9vSIgPA",
          "amount": 5,
          "currency": "XOF"
        }
      ],
      "nextAction": {
        "data": {
          "method": "post"
        }
      },
      "paymentInformation": {
        "recipient_name_hashmac": "a1b2c3d4e5f6",
        "recipient_phone_hashmac": "a1b2c3d4e5f6",
        "customer_id_hashmac": "a1b2c3d4e5f6"
      },
      "onSuccessRedirectionUrl": "https://my.website.com/cancel",
      "onFailedRedirectionUrl": "https://my.website.com/finish"
    }
  ],
  "mode": "live",
  "nextAction": {
    "data": {
      "method": "post"
    }
  },
  "overrideBusinessName": "MyBusiness",
  "subMerchantId": "submerchant_123"
}