Generate a checkout URL

Generate a one-time checkout url for your customer.

The checkout URL is only valid for one-time use only

URI

POST

https://api.tryduplo.com/v1/checkout/

Parameters

Authorization string

set value to Bearer SECRET_KEY

Body Param

business_id string required

Merchant Business ID

customer_firstname string required

Customer's first name

customer_lastname string required

Customer's last name

customer_phone_number string required

Customer's phone number

customer_email string required

Customer's email address

fee_bearer string required

Specifies who would bear the transaction fee can only be a customer or business.

prefered_payment_method string required

Specifies the payment method for the checkout, this is set to pay-with-transfer by default. Available options include pay-with-transfer or bnpl

shipping_fee number required

Shipping fee, set value to zero (0) if this is not applicaple.

amount number

Specifies the exact amount a virtual account should receive

line_items array required

A list of objects that specifies the item(s) the customer is about to pay for e.g:

[
    {
        "name": "Bottle water",
        "unit_price": 100,
        "quantity": 2
    }
]

discount object required

An object that specify the discount(s) on the item(s) the customer is about to pay for, the value should be set to zero (0) if discount no is applied e.g:

{
    "type": "Buy 1 get one free",
    "value": 10
}

tax object required

Tax objects specify the tax on the item(s) the customer is about to pay for, the value should be set to zero (0) if tax no is applied e.g:

{
   "type": "Buy 1 get one free",
   "value": 10,
   "description": "VAT"
}

customer_ref string

A customer reference. Refers to the customer that made the checkout.

metadata.customer list

Holds customer when customer details is different from the previously saved info. e.g

"metadata": {
    "customer": {
        "email": "bf@yopmail.com",
        "phone_number": "08022215915",
        "first_name": "Bamidele",
        "last_name": "Faruk"
    }
}

The customer will only be allowed to pay the exact amount, any other amount will be rejected.

Sample request

curl --location --request POST 'https://api.tryduplo.com/v1/checkout/' \
--header 'dpmlekdno: swwwje4t343643' \
--data-raw '{
    "business_id": "",
    "customer_firstname": "John",
    "customer_lastname": "Doe",
    "customer_email": "johndoe@yopmail.com",
    "customer_phone_number": "08022213915",
    "amount": "1200",
    "fee_bearer": "customer",
    "preferred_payment_methods": "pay-with-transfer",
    "line_items": [
        {
            "name": "Bottle water",
            "unit_price": 100,
            "quantity": 2
        }
    ],
    "shipping_fee": 50,
    "discount": {
       type: "percentage",
       value: 10,
    }
    "tax": {
      type: "percentage",
      value: 20,
      description: "VAT",
    },
    "redirect_url": "myurl.com"
}'

Duplo Response

{
    "data": {
        "customer_firstname": "Bamidele2",
        "customer_lastname": "Faruk",
        "customer_email": "bf@yopmail.com",
        "customer_phone_number": "08022215915",
        "currency": "NGN",
        "amount": 310,
        "fee": 100,
        "fee_bearer": "customer",
        "preferred_payment_methods": "pay-with-transfer",
        "is_active": true,
        "created_at": "2023-03-29T09:53:14.410Z",
        "updated_at": "2023-03-29T09:53:14.410Z",
        "business_id": "8ed10fcc-1e1c-4ad1-9ed8-e870d6543349",
        "checkout_ref": "che_Zlh9F5N4ei6O",
        "line_items": [
            {
                "name": "Bottle water",
                "unit_price": 200,
                "quantity": 1
            }
        ],
        "shipping_fee": 10,
        "discount": {
            "type": "amount",
            "value": 10
        },
        "tax": {
            "type": "amount",
            "value": 10,
            "description": "VAT"
        },
        "redirect_url": "davidigbigbi.com",
        "reference": "CHEZLH9F5N4EI6O20230329095314",
        "checkout_url": "https://checkout.tryduplo.com?reference=7dab3a284fcfd5900105268211629294:rn4181b518d6eb1ba8e2bde4a01f1abd7e176b8f522446d769b58fae77b17907b5c744fed48c0ded62d5035c8146ca58053fe137db2e608398d96bd6117c5c7695792b91e94901a6e00680e22cf391d363fe1eec04440c9b42220836eb1b820469f3e6026ccc75ac27428940d319e263159e8e38b40ed33b5affd9fcf76b6451aa7abf31cff3fda5a23c24831107f65abf5ab5c09fa77e1bc0561558b3707526278811d9ef9aa63bee40f105fcbeba084985e9a0b318ea557ce78f13e74a77c9a57ecacd8638fca48bb4409199b6623ef0",
        "customer_ref": "cus_HzpBpNoJZHeB",
        "metadata": {
            "customer": {
                "email": "bf@yopmail.com",
                "phone_number": "08022215915",
                "first_name": "Bamidele2",
                "last_name": "Faruk"
            }
        }
    },
    "errors": {},
    "message": "Request successful"
}

Once the request is done abstract the checkout_url gotten from the response and append the following

  • type = payment/bnpl (note this is dependent on the type of transaction that was initiated)

  • callback_url

  • cancel_url

Sample URL:

https://checkout.tryduplo.com?reference=eabf61d772a54b3bf5f69e116f2df5aa:rn06af819de62e6dd82cdfb176c8f342f0af7bfbaac306cd643abdcb22367535725cc742a063f88be11ea3bfc8bf5754ff842be90448dc21f44792e927cdf2fb7fa1e0a76e13697df18dab130e04434cae1f1cf8d9f608c72717d7a5557de7ac185e2ea8ffbab211ba81aa80666de1d1a773a34acf51bcdfbecff91e2635e97e66aa5887ee1ec0d4a21da7a9c2f750c2d5676589a2333dc1bee397e3112306974b9ab376de719fb9771d77104a2f09b923189348edd0392b3c960e2a145fc02244eca5757fe51b1168195c9dccc90e395fca4aba5c66eb3e92f39761a179413951&business_id=2534812c-8659-402b-838d-8eeed66c212a&type=payment&callback_url=https://paid.com&cancel_url=https://google.com

You would have to redirect the customer to the constructed URL in order for the customer to complete the transaction. When the customer transaction status is confirmed the customer will be redirected to your site or to the redirect URL you specified when generating the checkout URL.

Last updated