POST
/
checkouts
curl --request POST \
  --url https://pay.chargily.net/test/api/v2/checkouts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "items": [
    {
      "price": "<string>",
      "quantity": 123
    }
  ],
  "amount": 123,
  "currency": "<string>",
  "payment_method": "<string>",
  "success_url": "<string>",
  "customer_id": "<string>",
  "failure_url": "<string>",
  "webhook_endpoint": "<string>",
  "description": "<string>",
  "locale": "<string>",
  "pass_fees_to_customer": "<string>",
  "shipping_address": "<string>",
  "collect_shipping_address": true,
  "percentage_discount": 123,
  "amount_discount": 123,
  "metadata": [
    {}
  ]
}'
{
   "id": "01hj5n7cqpaf0mt2d0xx85tgz8",
   "entity": "checkout",
   "livemode": false,
   "amount": 2500,
   "currency": "dzd",
   "fees": 0,
   "pass_fees_to_customer": 0,
   "status": "pending",
   "locale": "en",
   "description": null,
   "metadata": null,
   "success_url": "https://my-app.com/payments/success",
   "failure_url": "https://my-app.com/payments/failure",
   "webhook_endpoint": null,
   "payment_method": null,
   "invoice_id": null,
   "customer_id": "01hj150206g0jxnh5r2yvvdrna",
   "payment_link_id": null,
   "created_at": 1703144567,
   "updated_at": 1703144567,
   "shipping_address": null,
   "collect_shipping_address": 0,
   "discount": {
        "type": "percentage",
        "value": 50
    },
   "amount_without_discount": 5000,
   "checkout_url": "https://pay.chargily.dz/test/checkouts/01hj5n7cqpaf0mt2d0xx85tgz8/pay"
}

Body parameters

items
array

Required if the parameters amount and currency are not provided.

The items are the products that are being sold.

amount
integer

Required if the parameter items is not provided.

The total amount of the checkout.

currency
string

Required if the parameter amount is provided.

A lowercase ISO currency code. Currently supported currencies are: “dzd”.

payment_method
string
default: "edahabia"

The payment method that will be used to pay the checkout. Currently supported payment methods are: “edahabia” and “cib”. The customer can always change the payment method at the checkout page.

success_url
string
required

The URL where your customer will be redirected after a successful payment.

customer_id
string

The ID of an existing Customer.

failure_url
string

The URL where your customer will be redirected after a failed or canceled payment.

webhook_endpoint
string

The URL of your endpoint that will receive the webhook events sent by Chargily Pay.

description
string

A description of the checkout. You can use this field to save a note about the checkout.

locale
string

The language of the checkout page, accepted values are: ‘ar’, ‘en’ or ‘fr’.

pass_fees_to_customer
string

A Boolean value indicating whether the Chargily Pay fees will be paid by you, the merchant, or by your customers.

shipping_address
string

The shipping address of the customer for the checkout.

collect_shipping_address
boolean

A Boolean value indicates whether the shipping address should be collected from the customer.

percentage_discount
integer

Prohibited if the parameter amount_discount is provided.

A percentage discount that will be applied to the total amount of the checkout.

amount_discount
integer

Prohibited if the parameter percentage_discount is provided.

An amount discount that will be applied to the total amount of the checkout.

metadata
array

A Set of key-value pairs that can be used to store additional information about the product.

Returns

If the request is successful, it returns a checkout object.