Create a Charge via API

Create one-time Pay Links programatically

Charges can be created for both standard Pay Links and subscription-based Pay Links.

Pre-requisites

In order to create a Charge using the Helio API, you need to complete the steps.

1. Create Helio Account & get API keys

  • You can learn how to set up a Helio account and generate your API keys by following the steps here.

  1. Create a Pay Link

  • You can learn how to create a Pay Link and explore all configuration options here.

Creating a Charge via API

NOTE: When using the production environment (app.hel.io), set your API endpoint to api.hel.io/v1 and generate API keys there. For the development environment, use api.dev.hel.io/v1 and generate API keys from app.dev.hel.io.

  • API Endpoint: https://api.hel.io/v1/charge/api-key

  • HTTP Method: POST

  • Required Query Parameters: ?apiKey={{Your public key here}}

  • Required Headers: Authorization: Bearer {{Your API Token here}}

Example Request Body:

{
    "paymentRequestId": "667974dbb38d45b726751902",
    "requestAmount": "0.2"
}
  • paymentRequestId refers to the ID of the Pay Link, which can be found at the end of your Pay Link's URL.

  • requestAmount is required only if your Pay Link is dynamic, as you must specify the price.

Example Response Body:

{
    "id": "667c375be240df9843f7f4f9",
    "pageUrl": "https://app.hel.io//charge/87e3482c-669b-4c62-ab01-23239889acb4"
}
  • "id" represents the id of the charge.

  • "pageUrl" is the url of the charge page.

Example Query:

curl --location 'https://api.hel.io/v1/charge/api-key?apiKey=<YOUR_PUBLIC_API_KEY>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_API_KEY' \
--data '{
    "paymentRequestId": "667974dbb38d45b726751902",
    "requestAmount": "0.2"
}'

From the following example replace: YOUR_PUBLIC_API_KEY, YOUR_SECRET_API_KEY, with the values you collected in the previous step.

Using additionalJSON in Your Request:

You can use the additionalJSON field within the customerDetails object to include any extra information you'd like to pass along with your payment request.

Example Request Body:

{
  "paymentRequestId": "66c49e24701f6930ee9c77dd",
  "requestAmount": "0.01",
  "prepareRequestBody": {
    "customerDetails": {
      "additionalJSON": "[]"
    }
  }
}

Example Query:

curl --location 'https://api.hel.io/v1/charge/api-key?apiKey=<YOUR_PUBLIC_API_KEY>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_API_KEY' \
--data '{
    "paymentRequestId": "667974dbb38d45b726751902",
    "requestAmount": "0.2"
    "prepareRequestBody": {
    "customerDetails": {
      "additionalJSON": "[]" # or whatever json you want here.
    }
  }
}'

Last updated