Create Payment Charge - POST

https://api.100pay.co/api/v1/pay/charge

The first step to accepting crypto payments with 100Pay Checkout is to create a payment Charge. The charge will include the customer details and the billing information.

It's important to know how the status response field works.

The context field is an Object that includes two fields: "status" and "value". The status fields is the payment status and the value field is the amount the user paid. If the status is "underpaid", then it returns how much the was underpaid so you can use this in a case of refund. If the status is "overpaid", it will return how much was overpaid and if it is "unpaid" or "notpaid", it returns a zero value (0).

"status": {
    "context": {
        "status": "notpaid", // paid, unpaid, overpaid, underpaid
        "value": 0
    },
    "value": "unpaid" // paid, unpaid, overpaid, underpaid
},

Required Fields:

FieldTypeDescription
CustomerObjectEasily identify your customers by passing their basic information to the customer object.

"customer": {
"user_id": "111",
"name": "Brainy Josh",
"phone": "80123456789",
"email": "[email protected]"
},
billingObject"billing": {
"currency": "NGN", // the currency you wish to charge the customer in
"vat": 10, // not required, you can calculate this yourself
"pricing_type": "fixed_or_partial_price", // set to "fixed" if you're expecting an exact amount or
"partial" if you're expecting a partial payment.
"description": "MY TEST PAYMENT", // help the customer know what he's paying for.
"amount": "10000", // The amount you're charging the customer
"country": "NG" // The billing Country.
},`
metadataObjectThis can include any field. In most cases, you will need extra fields to store information about the customer or the payment itself that you would need later to give value to the customer. you will be able to access this information later in the request sent to your webhook when new payments arrive.
ref_idStringGenerate something random you can request from the customer later if you need to resolve an issue.
call_back_url1StringThis is mostly used when you are using the 100pay hosted checkout and need to redirect the user to a webpage later. so you can pass anything to it.
userIdStringUse this field to store your userId incase you ned it later.
charge_sourseStringUse "api" if you're calling 100Pay checkout from your backend. And "checkout" if you're using the 100pay checkout payment modal.

AUTHORIZATION - API Key

This request is using API Key from collection Overview

HEADERS

api-key - LIVE;PK;

Body - raw (json)

{
"ref_id": "012232",
"customer": {
    "user_id": "111",
    "name": "Brainy Josh",
    "phone": "80123456789",
    "email": "[email protected]"
},
"billing": {
    "description": "MY TEST PAYMENT",
    "amount": "10000",
    "country": "NG",
    "currency": "NGN",
    "vat": "10",
    "pricing_type": "fixed_or_partial_price"
},
"metadata": {
    "is_approved": "yes"
},
"call_back_url": "http://localhost:8000/verify-payment",
"userId": "6143bfb7fe85e0020bf243f9",
"charge_source": "api"
}

Example Request

curl --location 'https://api.100pay.co/api/v1/pay/charge' \
--header 'api-key: LIVE;PK;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjYyZWU1ZGJmYjAyOWI3MDAyZDViNzQ1MyIsInVzZXJJZCI6IjYyOGIyMjhiMTlhYzUyMDAyYzU4ODUyNSIsImlhdCI6MTY1OTc4ODczNX0.wGyE9qfgsmsOLVTQQ9GrTFZ28moPB31I2eZw7uwd7Gw' \
--data-raw '{
"ref_id": "012232",
"customer": {
    "user_id": "111",
    "name": "Brainy Josh",
    "phone": "80123456789",
    "email": "[email protected]"
},
"billing": {
    "description": "MY TEST PAYMENT",
    "amount": "10000",
    "country": "NG",
    "currency": "NGN",
    "vat": "10",
    "pricing_type": "fixed_or_partial_price"
},
"metadata": {
    "is_approved": "yes"
},
"call_back_url": "http://localhost:8000/verify-payment",
"userId": "6143bfb7fe85e0020bf243f9",
"charge_source": "api"
}'
json
headers
{
"billing": {
  "currency": "NGN",
  "vat": 10,
  "pricing_type": "fixed_or_partial_price",
  "description": "MY TEST PAYMENT",
  "amount": "10000",
  "country": "NG"
},
"status": {
  "context": {
    "status": "notpaid",
    "value": 0
  },
  "value": "unpaid"
},
"ref_id": "012232",
"charge_source": "api",
"createdAt": "2023-03-12T20:15:30.107Z",
"_id": "6417a11887aae400371762c7",
"customer": {
  "user_id": "111",
  "name": "Brainy Josh",
  "phone": "80123456789",
  "email": "[email protected]"
},
"metadata": {
  "is_approved": "yes"
},
"call_back_url": "http://localhost:8000/verify-payment",
"userId": "628b228b19ac52002c588525",
"app_id": "62ee5dbfb029b7002d5b7453",
"chargeId": "6417a11887aae400371762c7",
"__v": 0,
"hosted_url": "https://pay.100pay.co/pay/6417a11887aae400371762c7"
}