Payment Link


Required Header

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

Create Payment Link

Endpoint

Method URI
POST /payment-links

Data Body

KEY TYPE Rule Description
email string required The email address of the payer
currency string required Three-letter ISO currency code, in uppercase (e.g. MYR)
amount string required Amount in cents format with minimum of 500 and maximum of 3000000 (e.g. RM1 = 100)
title string required The payment title with no greater than 50 characters
phone_no string optional The phone number of the payer
description string optional The description of payment link
redirect_url string optional A URL where will be redirected after payment has been made. If no URL is sent, it will be redirected to the Swipe thank you page
reference string optional The first payment reference with no greater than 50 characters
reference_2 string optional The second payment reference with no greater than 50 characters
send_email boolean optional Whether to send email to notify payer regarding the new payment link. If false , email will not be sent to notify payer.

Update Payment Link

Endpoint

Method URI
PUT /payment-links/{payment_link_id}

Data Body

KEY TYPE RULE Description
email string required The email address of the payer
currency string required Three-letter ISO currency code, in uppercase (e.g. MYR)
amount string required Amount in cents format with minimum of 500 and maximum of 3000000 (e.g. RM1 = 100)
title string required The payment title with no greater than 50 characters
phone_no string optional The phone number of the payer
description string optional The description of payment link
redirect_url string optional A URL where will be redirected after payment has been made. If no URL is sent, it will be redirected to the Swipe thank you page
reference string optional The first payment reference with no greater than 50 characters
reference_2 string optional The second payment reference with no greater than 50 characters
send_email boolean optional Whether to send email to notify payer regarding the new payment link. If false , email will not be sent to notify payer.

Get Payment Link

Endpoint

Method URI
GET /payment-links/{payment_link_id}

Index Payment Link

Endpoint

Method URI
GET /payment-links

Delete Payment Link

Endpoint

Method URI
DELETE /payment-links/{payment_link_id}

Example

{
    "email": "email@example.com",
    "phone_no": "60123456789",
    "currency": "MYR",
    "amount": 10000,
    "title": "Test Payment Link",
    "description": "Testing payment link",
    "redirect_url": "https://www.paymenttest.com/payment/redirect",
    "reference": "reference 1",
    "reference_2": "reference 2"
}

{success} Success Response

Code 200

Response

{
    "success": true,
    "data": {
        "_id": "61aefffdc0e0335ed54194d5",
        "email": "email@example.com",
        "phone_no": "60123456789",
        "currency": "MYR",
        "amount": 10000,
        "title": "Test Payment Link",
        "description": "Testing payment link",
        "redirect_url": "https://www.paymenttest.com/payment/redirect",
        "reference": "reference 1",
        "reference_2": "reference 2",
        "updated_at": "2021-12-07T06:32:29.757000Z",
        "created_at": "2021-12-07T06:32:29.757000Z",
        "status": "Active",
        "payment_url": "http://localhost:8080/payment/link/pay?id=61aefffdc0e0335ed54194d5",
        "business_id": 1,
        "paid": false
    },
    "errors": null,
    "meta": {
        "timestamp": "2021-12-12 06:00:00 UTC",
        "timezone": "UTC"
    }
}

{danger} Error Response

Code 422

Response



{
    "message" : "The given data was invalid.",
    "errors"  : {
        "currency"  : ["The currency field is required."],
        "email"     : ["The email field is required."],
        "amount"    : ["The amount field is required."],
        "title"     : ["The title field is required."]
    }
}