Key | Value |
---|---|
Accept | application/json |
Content-Type | application/json |
Authorization | Bearer {API-KEY} |
Create a new subscription for your customer.
Method | URI |
---|---|
POST | /subscriptions |
KEY | TYPE | RULE | DESCRIPTION |
---|---|---|---|
package_id | string |
required |
Unique identifier for the package |
string |
required |
The email address of subscriber | |
phone_no | string |
optional |
The phone number of subscriber |
{
"package_id": "6226bd0e0f384c3f3f084820",
"email": "test@test.com",
"phone_no": "0123456789"
}
Retrieve customer's subscription details.
Method | URI |
---|---|
GET | /subscriptions/{subscription_id} |
Update an existing customer's subscription details based on specified parameters.
Method | URI |
---|---|
PUT | /subscriptions/{subscription_id} |
KEY | TYPE | RULE | DESCRIPTION |
---|---|---|---|
string |
optional |
The email address of subscriber | |
phone_no | string |
optional |
The phone number of subscriber |
status | string |
optional |
The status of subscription |
{
"email": "test@test.com",
"phone_no": "0123456789",
"status": "cancel"
}
Delete customer's subscription. This process will not be recoverable.
Method | URI |
---|---|
DELETE | /subscriptions/{subscription_id} |
List all subscriptions of your business.
Method | URI |
---|---|
GET | /subscriptions |
{success} Success Response
Code 200
Response
{
"success": true,
"data": {
"_id": "622b002e8a82a66bbc142892",
"package_id": "62285c23b97cf205d127fc42",
"email": "test@test.com",
"phone_no": "0135323922",
"status": "created",
"updated_at": "2022-03-11T07:54:22.106000Z",
"created_at": "2022-03-11T07:54:22.106000Z",
"package": {
"_id": "62285c23b97cf205d127fc42",
"name": "Test Package",
"description": "Test Package Description",
"amount": 25,
"frequency": "yearly",
"currency": "MYR",
"date_charge_start": "2002-07-12",
"business_id": 1,
"status": "cancel",
"updated_at": "2022-03-09T07:49:55.042000Z",
"created_at": "2022-03-09T07:49:55.042000Z"
},
"payment_links": []
},
"errors": null,
"meta": {
"timestamp": "2022-03-11 07:54:22 UTC",
"timezone": "UTC"
}
}
{danger} Error Response
Code 422
Response
{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required."
]
}
}