Subscription


Required Header

Key Value
Accept application/json
Content-Type application/json
Authorization Bearer {API-KEY}

Create Subscription

Create a new subscription for your customer.

Endpoint

Method URI
POST /subscriptions

Data Body

KEY TYPE RULE DESCRIPTION
package_id string required Unique identifier for the package
email string required The email address of subscriber
phone_no string optional The phone number of subscriber

Example

{
    "package_id": "6226bd0e0f384c3f3f084820",
    "email": "test@test.com",
    "phone_no": "0123456789"
}

Retrieve Subscription

Retrieve customer's subscription details.

Endpoint

Method URI
GET /subscriptions/{subscription_id}

Update Subscription

Update an existing customer's subscription details based on specified parameters.

Endpoint

Method URI
PUT /subscriptions/{subscription_id}

Data Body

KEY TYPE RULE DESCRIPTION
email string optional The email address of subscriber
phone_no string optional The phone number of subscriber
status string optional The status of subscription

Example

{
    "email": "test@test.com",
    "phone_no": "0123456789",
    "status": "cancel"
}

Delete Subscription

Delete customer's subscription. This process will not be recoverable.

Endpoint

Method URI
DELETE /subscriptions/{subscription_id}

List Subscription

List all subscriptions of your business.

Endpoint

Method URI
GET /subscriptions

Example

{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": 2500,
            "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."
        ]
    }
}