Recurring Billing
Create a Subscription Plan
A subscription plan consists of basic information like plan name, amount, and frequency. An example of a subscription plan could be “Spotify Premium Membership” which is SGD 9.90 monthly.
POST
/v1/subscription-plan
X-BUSINESS-API-KEY*
X-Requested-With
curl --request POST \
--url https://api.sandbox.hit-pay.com/v1/subscription-plan \
--header 'Content-Type: application/json' \
--header 'X-BUSINESS-API-KEY: <x-business-api-key>' \
--data '{
"amount": 0,
"cycle": "<cycle>",
"name": "<name>"
}'
{
"status": "200",
"example": "{\n \"id\": \"973ee344-6737-4897-9929-edbc9d7bf433\",\n \"name\": \"Spotify Premium\",\n \"description\": \"Spotify Monthly Subscription\",\n \"cycle\": \"monthly\",\n \"cycle_repeat\": null,\n \"cycle_frequency\": null,\n \"currency\": \"sgd\",\n \"amount\": 9.90,\n \"reference\": \"spotify_premium_2022\",\n \"created_at\": \"2022-09-12T14:19:26\",\n \"updated_at\": \"2022-09-12T14:19:26\"\n}"
}
Authorizations
X-BUSINESS-API-KEYheaderrequired
string
Headers
X-Requested-With
Default: "XMLHttpRequest"string
Body
application/json
amountrequired
integer
Min: 1, Max: 999999.99. It's required field
currency
Default: "Plan amount currency"string
Example: SGD
cyclerequired
Default: "monthly"string
Billing frequency (weekly / monthly / yearly / custom / save_card). If cycle = custom then the user has to send the fields cycle_repeat and cycle_frequency
cycle_frequency
string
[This field is only applicable when cycle = custom] It's the frequency of the cycle [day / week / month / year]
cycle_repeat
integer
[This field is only applicable when cycle = custom] It's the number of times the cycle will repeat.
description
string
The description of subscription plan
namerequired
string
Plan name. It's required field
reference
string
Arbitrary reference number that you can map to your internal reference number. This value cannot be edited by the customer
Response
200 - application/json
amount
Default: "0"number
created_at
string
currency
string
cycle
string
cycle_frequency
any
cycle_repeat
any
description
string
id
string
name
string
reference
string
updated_at
string
curl --request POST \
--url https://api.sandbox.hit-pay.com/v1/subscription-plan \
--header 'Content-Type: application/json' \
--header 'X-BUSINESS-API-KEY: <x-business-api-key>' \
--data '{
"amount": 0,
"cycle": "<cycle>",
"name": "<name>"
}'
{
"status": "200",
"example": "{\n \"id\": \"973ee344-6737-4897-9929-edbc9d7bf433\",\n \"name\": \"Spotify Premium\",\n \"description\": \"Spotify Monthly Subscription\",\n \"cycle\": \"monthly\",\n \"cycle_repeat\": null,\n \"cycle_frequency\": null,\n \"currency\": \"sgd\",\n \"amount\": 9.90,\n \"reference\": \"spotify_premium_2022\",\n \"created_at\": \"2022-09-12T14:19:26\",\n \"updated_at\": \"2022-09-12T14:19:26\"\n}"
}