Introduction

The Paysley API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

You can use the Paysley API in test/development mode, which does not affect your live data or interact with the banking networks. The URL and API key you use to authenticate the request determines whether the request is live mode or test mode.

Authentication

The Paysley API uses API keys to authenticate requests. You can view and manage your API keys in the Paysley Developer Dashboard.

Every application have two access keys in place, development mode and production mode

Development mode specifications:

  • The URL is https://test.paysley.io/.
  • Access key have the prefix py_test_.

Production mode specifications:

  1. The URL is https://live.paysley.io/.
  2. Access key have the prefix py_live_.
  3. Connect your application with a merchant.
  4. Change your status application to Published.
  5. Merchant have to enable your application on their dashboard.

Your Access keys carry many privileges, so be sure to keep them secure! Do not share your access API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Bearer Auth. Provide your Access key as the bearer auth value.

This is the example with CURL.

curl -X GET https://test.paysley.io/v2/payments -H "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Errors
Status code Description
200 - OK Everything worked as expected.
400 - Bad Request The request was unacceptable, often due to missing a required parameter.
401 - Unauthorized No valid API key provided.
402 - Request Failed The parameters were valid but the request failed.
403 - Forbidden The API key doesn't have permissions to perform the request.
404 - Not Found The requested resource doesn't exist.
409 - Conflict The request conflicts with another request (perhaps due to using the same idempotent key).
429 - Too Many Requests Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.
500, 502, 503, 504 - Server Errors Something went wrong on Paysley's end. (These are rare.)
Payment Requests

Request a payment to your customer email or mobile number with this feature. We will send invoice to the customer automatically.

We support Credit Card, Direct Debit, Paypal, Apple Pay, Google Pay, Nedbank, etc. With paysley wallet in place, customer can pay quickly with payment options that has been saved.

This payment request is intended for one time payment.

Create a Payment Request

Create a new single payment request.

Body Params
Field Description
request_methods

required

array

"EMAIL" if you want to send invoice through email. "SMS" if you want to send invoice through SMS. "WEB" if you don't want us to send invoice at all but you still need email or mobile_number. Example: ['EMAIL', 'SMS', 'WEB']

reference_number

string

This will help you indentify a request. Example: "OO-1234-2020"

email

required with condition

string

Customer email, required if request_methods is containing "EMAIL". Example: "john@doe.com"

merchant_phone_number

string

Merchant mobile number that used to send SMS. You can buy the number in merchant dashboard. Example: "+1234567890"

mobile_number

required with condition

string

Customer mobile number, required if request_methods is containing "SMS". Example: "+1234567890"

amount

required

number

The amount of payment for this request Example: 3

currency

required

string

The currency of this payment request in 3 digit ISO format Example: "USD"

fixed_amount

required

boolean

Boolean value between true and false. If set to false, customer can specify the amount they would like to pay. Commonly used for donation payments.

tax_id

number

Tax profile ID to calculate the tax amount for this payment. If it does not exist, the amount value will be tax free.

template_id

number

The Email or SMS template you would like to use with this payment. When empty, the payment request will be send using merchant's default template. If merchant does not set the default template, it will automatically send Paysley's default template.

payment_type

string

Add optional payment_type by default it's filled with DB. Set it to "PA" to use Pre Authorization. You need to manually capture to accept the payment.

payment_methods

array

Add optional payment methods that can be used to pay this request. You can add "APPLE_PAY", "GOOGLE_PAY" or "NEDBANK_EFT" in a single array

moto_enabled

boolean

Enable MOTO card mode which have no additional authentication on payment widget

shipping_enabled

boolean

Add optional shipping information that can be filled for this request.

send_mms_invoice

boolean

Use "true" if you want Paysley to help you send an invoice through MMS. (Only available for USA and Canada mobile carriers.) Other non-supported countries will send an extended SMS with an URL to download the respective invoice. You will be charged based on your MMS and SMS fee where applicable.

attach_invoice

boolean

Use "true" if you want Paysley to attach an invoice as a file and send it through email.

invoice_url

string

The url of the invoice file. If it's not exist, the message template will be used as the invoice content.

send_mms_receipt

boolean

Use "true" if you want Paysley to help you send a payment receipt through MMS or SMS. You will be charged on your MMS and SMS fee where applicable.

attach_receipt

boolean

Use "true" if you want the payment receipt to be attached as a file and sent through email.

receipt_file_type

string

File type for payment receipt. Available value: "pdf/jpeg/png", default value pdf.

expiry_date

string

The expiry date for this payment request. Format = YYYY-MM-DD HH:MM

customer_id

string

Customer ID used to update customer data if exist. Example: "h3xDi8"

customer_salutation

string

Mr, Mrs, or Miss. Example: "Mr"

customer_first_name

string

Customer first name. Example: "John"

customer_last_name

string

Customer last name. Example: "Doe"

send_confirmation

string

Use "true" if you want Paysley to help you send the confirmation sms/email after payment is succeed. Use "false" if you want to send the confirmation by yourself

response_url

string

Response_url is the url where customer will get the payment result. After the transaction is paid, the payment response will be posted to the response_url. Example: "http://mypaysleymerchant.com/response/"

cancel_url

string

The url where customer will redirected when customer click cancel button on payment page. Example: "https://mywebsite.com"

redirect_url

string

After payment we will redirect to this URL. If empty, we will show the receipt page instead. Example: "http://mypaysleymerchant.com/receipt/"

Required Header:

  • Authorization
Request URL  
https://test.paysley.io/v2/payment-requests/
Request Body
{
  "request_methods": [ "SMS"],
  "reference_number": "123",
  "email": "example@example.com",
  "merchant_phone_number": null,
  "mobile_number": "+12345678901",  
  "customer_id": "",
  "customer_salutation": "Mr",
  "customer_first_name": "John",
  "customer_last_name" : "Preston",
  "redirect_url" : "https://paysley.com",
  "response_url" : "https://paysley.com",
  "cancel_url" : "https://paysley.com",
  "fixed_amount": true,
  "currency": "ZAR",
  "amount": 1500.12,
  "tax_id": "",
  "template_id": "",
  "moto_enabled": false, 
  "shipping_enabled": false, 
  "send_mms_invoice": true,
  "attach_invoice": true,
  "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
  "attach_receipt": true, 
  "receipt_file_type": "pdf",
  "payment_type": "DB",
  "payment_methods": ["APPLE_PAY", "GOOGLE_PAY", "NEDBANK_EFT"],
  "expiry_date": ""
}

Examples
curl -X POST https://test.paysley.io/v2/payment-requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0" \
--data '{
    "request_methods": [ "SMS"],
    "reference_number": "123",
    "email": "example@example.com",
    "merchant_phone_number": null,
    "mobile_number": "+12345678901",
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name" : "Preston",
    "redirect_url" : "https://paysley.com",
    "response_url" : "https://paysley.com",
    "cancel_url" : "https://paysley.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false,
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date": ""
}'
import requests
import json

url = "https://test.paysley.io/v2/payment-requests"

payload = json.dumps( {
    "request_methods": [ "SMS"],
    "reference_number": "123",
    "email": "example@example.com",
    "merchant_phone_number": None,
    "mobile_number": "+12345678901",
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name" : "Preston",
    "redirect_url" : "https://paysley.com",
    "response_url" : "https://paysley.com",
    "cancel_url" : "https://paysley.com",
    "fixed_amount": True,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": False,
    "shipping_enabled": False,
    "send_mms_invoice": True,
    "attach_invoice": True,
    "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": True,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date": ""
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://test.paysley.io/v2/payment-requests',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
    },
    body: JSON.stringify({
        "request_methods": [ "SMS"],
        "reference_number": "123",
        "email": "example@example.com",
        "merchant_phone_number": null,
        "mobile_number": "+12345678901",
        "customer_id": "",
        "customer_salutation": "Mr",
        "customer_first_name": "John",
        "customer_last_name" : "Preston",
        "redirect_url" : "https://paysley.com",
        "response_url" : "https://paysley.com",
        "cancel_url" : "https://paysley.com",
        "fixed_amount": true,
        "currency": "ZAR",
        "amount": 1500.12,
        "tax_id": "",
        "template_id": "",
        "moto_enabled": false,
        "shipping_enabled": false,
        "send_mms_invoice": true,
        "attach_invoice": true,
        "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
        "attach_receipt": true,
        "receipt_file_type": "pdf",
        "payment_type": "DB",
        "payment_methods": [
            "APPLE_PAY",
            "GOOGLE_PAY",
            "NEDBANK_EFT"
        ],
        "expiry_date": ""
    })

};
request(options, function (error, response) { 
    if (error) throw new Error(error);
    console.log(response.body);
});
$curl = curl_init();

$data = array(
    "request_methods" => [ "SMS"],
    "reference_number" => "123",
    "email" => "example@example.com",
    "merchant_phone_number" => null,
    "mobile_number" => "+12345678901",
    "customer_id" => "",
    "customer_salutation" => "Mr",
    "customer_first_name" => "John",
    "customer_last_name"  => "Preston",
    "redirect_url"  => "https://paysley.com",
    "response_url"  => "https://paysley.com",
    "cancel_url"  => "https://paysley.com",
    "fixed_amount" => true,
    "currency" => "ZAR",
    "amount" => 1500.12,
    "tax_id" => "",
    "template_id" => "",
    "moto_enabled" => false,
    "shipping_enabled" => false,
    "send_mms_invoice" => true,
    "attach_invoice" => true,
    "invoice_url" => "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt" => true,
    "receipt_file_type" => "pdf",
    "payment_type": "DB",
    "payment_methods" => [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date" => ""
);
$data = json_encode($data);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payment-requests",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"
require 'json'

url = URI("https://test.paysley.io/v2/payment-requests")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
request.body = {
    request_methods: [ "SMS"],
    reference_number: "123",
    email: "example@example.com",
    merchant_phone_number: nil,
    mobile_number: "+12345678901",
    customer_id: "",
    customer_salutation: "Mr",
    customer_first_name: "John",
    customer_last_name: "Preston",
    redirect_url: "https://paysley.com",
    response_url: "https://paysley.com",
    cancel_url: "https://paysley.com",
    fixed_amount: true,
    currency: "ZAR",
    amount: 1500.12,
    tax_id: "",
    template_id: "",
    moto_enabled: false,
    shipping_enabled: false,
    send_mms_invoice: true,
    attach_invoice: true,
    invoice_url: "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    attach_receipt: true,
    receipt_file_type: "pdf",
    payment_type: "DB",
    payment_methods: [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    expiry_date: ""
}.to_json

response = https.request(request)
puts response.read_body

Result Format
{
  "amount": "1500.12", 
  "attach_invoice": true, 
  "attach_receipt": true, 
  "cancel_url": "https://google.com", 
  "created_at": "2020-02-19T06:43:50.000Z", 
  "currency": "ZAR", 
  "customer_first_name": "John", 
  "customer_id": "", 
  "customer_last_name": "Preston", 
  "customer_salutation": "Mr", 
  "email": "example@example.com", 
  "expiry_date": "", 
  "fixed_amount": true, 
  "invoice_url": "https://upload.wikimedia.org/wikipedia/commons/a/a8/CCU_Logo.jpeg", 
  "long_url": "https://long-url", 
  "merchant_phone_number": null, 
  "mobile_number": "+12345678901", 
  "modified_at": "", 
  "payment_methods": [
    "GOOGLE_PAY"
  ], 
  "payment_type": "DB", 
  "qrcode_link": "https://qrcodelink", 
  "receipt_file_type": "pdf", 
  "redirect_url": "https://google.com", 
  "reference_number": "123", 
  "request_methods": [
    "SMS"
  ], 
  "response_url": "https://google.com", 
  "result": "success", 
  "send_mms_invoice": true, 
  "send_mms_receipt": false, 
  "shipping_enabled": false, 
  "short_url": "https://short-url", 
  "tax_id": "", 
  "template_id": "", 
  "transaction_id": "145510OO"
}
{
     "message": "Forbidden"
}
{
    "is_valid": false,
    "error_field": "",
    "error_message": "Apple Pay is not enabled. Please check your cofiguration and/or contact your administrator.",
    "result": "failed"
}

Request Samples
Loading...
Edit a Payment Request

You can update the payment request by using the same parameters from create a payment request, but you have to add transaction_id to the body.

Required Header:

  • Authorization
Request URL  
https://test.paysley.io/v2/payment-requests/
Request Body
{
    "transaction_id": "2116376OO",
    "request_methods": [ "WEB"],
    "reference_number": "123",
    "email": "example@example.com",
    "merchant_phone_number": null,
    "mobile_number": "+12345678901",  
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name" : "Preston",
    "redirect_url" : "https://paysley.com",
    "response_url" : "https://paysley.com",
    "cancel_url" : "https://paysley.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false, 
    "shipping_enabled": false, 
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true, 
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": ["APPLE_PAY", "GOOGLE_PAY", "NEDBANK_EFT"],
    "expiry_date": ""
}

Examples
curl -X PUT https://test.paysley.io/v2/payment-requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0" \
--data '{
    "transaction_id": "2116376OO",
    "request_methods": [ "WEB"],
    "reference_number": "123",
    "email": "example@example.com",
    "merchant_phone_number": null,
    "mobile_number": "+12345678901",
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name" : "Preston",
    "redirect_url" : "https://paysley.com",
    "response_url" : "https://paysley.com",
    "cancel_url" : "https://paysley.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false,
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date": ""
}'
import requests
import json

url = "https://test.paysley.io/v2/payment-requests"

payload = json.dumps( {
    "transaction_id": "2116376OO",
    "request_methods": [ "WEB"],
    "reference_number": "123",
    "email": "example@example.com",
    "merchant_phone_number": None,
    "mobile_number": "+12345678901",
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name" : "Preston",
    "redirect_url" : "https://paysley.com",
    "response_url" : "https://paysley.com",
    "cancel_url" : "https://paysley.com",
    "fixed_amount": True,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": False,
    "shipping_enabled": False,
    "send_mms_invoice": True,
    "attach_invoice": True,
    "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": True,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date": ""
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("PUT", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
    'method': 'PUT',
    'url': 'https://test.paysley.io/v2/payment-requests',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
    },
    body: JSON.stringify({
        "transaction_id": "2116376OO",
        "request_methods": [ "WEB"],
        "reference_number": "123",
        "email": "example@example.com",
        "merchant_phone_number": null,
        "mobile_number": "+12345678901",
        "customer_id": "",
        "customer_salutation": "Mr",
        "customer_first_name": "John",
        "customer_last_name" : "Preston",
        "redirect_url" : "https://paysley.com",
        "response_url" : "https://paysley.com",
        "cancel_url" : "https://paysley.com",
        "fixed_amount": true,
        "currency": "ZAR",
        "amount": 1500.12,
        "tax_id": "",
        "template_id": "",
        "moto_enabled": false,
        "shipping_enabled": false,
        "send_mms_invoice": true,
        "attach_invoice": true,
        "invoice_url": "https://py-fixed-assets.s3.amazonaws.com/logo.png",
        "attach_receipt": true,
        "receipt_file_type": "pdf",
        "payment_type": "DB",
        "payment_methods": [
            "APPLE_PAY",
            "GOOGLE_PAY",
            "NEDBANK_EFT"
        ],
        "expiry_date": ""
    })

};
request(options, function (error, response) { 
    if (error) throw new Error(error);
    console.log(response.body);
});
$curl = curl_init();

$data = array(
    "transaction_id" => "2116376OO",
    "request_methods" => [ "WEB"],
    "reference_number" => "123",
    "email" => "example@example.com",
    "merchant_phone_number" => null,
    "mobile_number" => "+12345678901",
    "customer_id" => "",
    "customer_salutation" => "Mr",
    "customer_first_name" => "John",
    "customer_last_name"  => "Preston",
    "redirect_url"  => "https://paysley.com",
    "response_url"  => "https://paysley.com",
    "cancel_url"  => "https://paysley.com",
    "fixed_amount" => true,
    "currency" => "ZAR",
    "amount" => 1500.12,
    "tax_id" => "",
    "template_id" => "",
    "moto_enabled" => false,
    "shipping_enabled" => false,
    "send_mms_invoice" => true,
    "attach_invoice" => true,
    "invoice_url" => "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt" => true,
    "receipt_file_type" => "pdf",
    "payment_type": "DB",
    "payment_methods" => [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    "expiry_date" => ""
);
$data = json_encode($data);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payment-requests",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"
require 'json'

url = URI("https://test.paysley.io/v2/payment-requests")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
request.body = {
    transaction_id: "2116376OO",
    request_methods: [ "WEB"],
    reference_number: "123",
    email: "example@example.com",
    merchant_phone_number: nil,
    mobile_number: "+12345678901",
    customer_id: "",
    customer_salutation: "Mr",
    customer_first_name: "John",
    customer_last_name: "Preston",
    redirect_url: "https://paysley.com",
    response_url: "https://paysley.com",
    cancel_url: "https://paysley.com",
    fixed_amount: true,
    currency: "ZAR",
    amount: 1500.12,
    tax_id: "",
    template_id: "",
    moto_enabled: false,
    shipping_enabled: false,
    send_mms_invoice: true,
    attach_invoice: true,
    invoice_url: "https://py-fixed-assets.s3.amazonaws.com/logo.png",
    attach_receipt: true,
    receipt_file_type: "pdf",
    payment_type: "DB",
    payment_methods: [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT"
    ],
    expiry_date: ""
}.to_json

response = https.request(request)
puts response.read_body

Result Format
{
    "result": "success",
    "transaction_id": "145497OO",
    "request_methods": [
        "WEB"
    ],
    "reference_number": "123",
    "email": "example@example.com",
    "mobile_number": "+12345678901",
    "merchant_phone_number": null,
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name": "Preston",
    "payment_type": "DB",
    "currency": "ZAR",
    "amount": "1500.12",
    "fixed_amount": true,
    "short_url": "https://shorturl",
    "long_url": "https://longurl",
    "qrcode_link": "https://qrlink",
    "tax_id": "",
    "template_id": "",
    "payment_methods": [
        "GOOGLE_PAY"
    ],
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://upload.wikimedia.org/wikipedia/commons/a/a8/CCU_Logo.jpeg",
    "send_mms_receipt": false,
    "attach_receipt": true,
    "receipt_file_type": "pdf",
    "expiry_date": "",
    "response_url": "https://google.com",
    "redirect_url": "https://google.com",
    "cancel_url": "https://google.com",
    "created_at": "2020-02-18T06:53:07.000Z",
    "modified_at": "2020-02-19T09:02:46.000Z"
}
{
    "is_valid": false,
    "error_field": "transaction_id",
    "error_message": "transaction_id not valid"
}
{
     "message": "Forbidden"
}

Request Samples
Loading...
Get a Payment Request detail

You can fetch a single payment request by using the GET method with a transaction_id in the route parameter.

Required Header:

  • Authorization
Request URL  
https://test.paysley.io/v2/payment-requests/{transaction_id}
Examples
curl -X GET https://test.paysley.io/v2/payment-requests/{transaction_id} \
--header "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests

url = "https://test.paysley.io/v2/payment-requests?page=5&limit=1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://test.paysley.io/v2/payment-requests?page=5&limit=1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payment-requests?page=5&limit=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"

url = URI("https://test.paysley.io/v2/payment-requests?page=5&limit=1")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"

response = https.request(request)
puts response.read_body

Result Format
{
  "limit": "1", 
  "page": "1", 
  "page_count": 84, 
  "total_count": 84, 
  "transactions": [
    {
      "amount": 739.88, 
      "attach_receipt_on_email": false, 
      "chargeback": [], 
      "created_at": "2020-01-30T10:53:45.000Z", 
      "currency": "EUR", 
      "email": "saad.jamalkhan@gmail.com", 
      "expiration_date": "2020-02-06T10:53:00.000Z", 
      "fixed_amount": true, 
      "invoice_url": null, 
      "merchant_phone_number": "+19196894607", 
      "mobile_number": "+23059418021", 
      "modified_at": null, 
      "payment_date": "2020-01-30T10:56:01.000Z", 
      "payment_id": "8ac7a4a26ff5c0c4016ff617ed2128fa", 
      "payment_methods": [], 
      "payment_type": "DB", 
      "receipt_file_type": null, 
      "reference_number": "44923", 
      "refund": [], 
      "request_methods": [
        "SMS", 
        "EMAIL"
      ], 
      "reversal": [], 
      "send_mms_receipt": false, 
      "shipping_information": false, 
      "status": "success", 
      "status_description": "", 
      "tax_id": "PKZMknlE", 
      "transaction_id": "145429OO", 
      "url": "https://s.mpaid.us/37cfJ"
    }
  ]
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Delete a Payment Request

You can delete a single payment request by using the DELETE method with a transaction_id in the route parameter.

Please note that you will not be allowed to delete a transaction that already has a payment history.

Required Header:

  • Authorization
Request URL  
https://test.paysley.io/v2/payment-requests/{transaction_id}
Examples
curl -X DELETE https://test.paysley.io/v2/payment-requests/{transaction_id} \
--header "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests

url = "https://test.paysley.io/v2/payment-requests/2116376OO"

payload  = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_live_9Au2ABAwToHDfMf1kiwr'
}

response = requests.request("DELETE", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://test.paysley.io/v2/payment-requests/2116376OO',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer py_live_9Au2ABAwToHDfMf1kiwr'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payment-requests/2116376OO",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_live_9Au2ABAwToHDfMf1kiwr"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"

url = URI("https://test.paysley.io/v2/payment-requests/2116376OO")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_live_9Au2ABAwToHDfMf1kiwr"

response = https.request(request)
puts response.read_body

Result Format
{
    "result": "success",
    "transaction_id": "145493OO"
}
{
    "is_valid": false,
    "error_field": "transaction_id",
    "error_message": "Transaction not found.",
    "result": "failed"
}

Request Samples
Loading...
Payment History

Fetch your payment history from Paysley in order to show how many payments have been done through our application.

Our payment history API support fetching payment history and refund a paid transaction

Get Payment History

You can get a list of payment history using our GET method.

Here are the available query string parameters to help you fetch the right payment history:

Query Description
start_date

string

Start search for payment history from the date entered into this parameter. The format is "YYYY-MM-DD"

end_date

required with condition

string

You need to specify the end_date if you specify the start_date. It use the same format of "YYYY-MM-DD"

page

number

Select the payment history

limit

number

Limit the amount of items fetched from payment history. The default value is 10

keywords

string

Search for a payment history that has the specified keyword in email, mobile number or reference number

Request URL  
https://test.paysley.io/v2/payments?{optional_parameter}
Examples
curl -X GET https://test.paysley.io/v2/payments?{optional parameters here} \
--header "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests

url = "https://test.paysley.io/v2/payments?limit=5&page=1"

payload = {}
headers = {
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0',
  'Content-Type': 'application/json'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://test.paysley.io/v2/payments?limit=5&page=1',
  'headers': {
    'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0',
    'Content-Type': 'application/json'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payments?limit=5&page=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"

url = URI("https://test.paysley.io/v2/payments?limit=5&page=1")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
request["Content-Type"] = "application/json"

response = https.request(request)
puts response.read_body

Result Format
{
  "limit": "5", 
  "page": "1", 
  "page_count": 133, 
  "payments": [
    {
      "amount": 1, 
      "currency": "ZAR", 
      "customer_phone_number": "", 
      "email": "example@example.com", 
      "payment_date": "2020-02-05T10:54:59.000Z", 
      "payment_id": "8ac7a4a1701475c2017014fd24255d52", 
      "payment_type": "CC.DB", 
      "reference_number": "asnkanskasa", 
      "reference_payment_id": null, 
      "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'", 
      "shipping_information": false, 
      "status": "success", 
      "transaction_date": "2020-02-05T10:48:23.000Z", 
      "transaction_id": "6954555OO", 
      "transaction_type": "once-off"
    }, 
    {
      "amount": 1, 
      "currency": "ZAR", 
      "customer_phone_number": "", 
      "email": "example@example.com", 
      "payment_date": "2020-02-05T03:55:25.000Z", 
      "payment_id": "8ac7a4a0701478cd017014fd894446c3", 
      "payment_type": "CC.RV", 
      "reference_number": "asnkanskasa", 
      "reference_payment_id": "8ac7a4a1701475c2017014fd24255d52", 
      "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'", 
      "shipping_information": false, 
      "status": "success", 
      "transaction_date": "2020-02-05T10:48:23.000Z", 
      "transaction_id": "6954555OO", 
      "transaction_type": "once-off"
    }, 
    {
      "amount": 1, 
      "currency": "ZAR", 
      "customer_phone_number": null, 
      "email": null, 
      "payment_date": "2020-02-05T03:36:34.000Z", 
      "payment_id": "8ac7a4a2701478ce017014ec48a233d2", 
      "payment_type": "CC.RF", 
      "reference_number": "prefix35", 
      "reference_payment_id": "8ac7a4a06efa4879016efd875f3872dc", 
      "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'", 
      "shipping_information": false, 
      "status": "success", 
      "transaction_date": "2019-12-13T03:16:43.000Z", 
      "transaction_id": "6955PO", 
      "transaction_type": "pos_payment"
    }, 
    {
      "amount": 1, 
      "currency": "ZAR", 
      "customer_phone_number": null, 
      "email": null, 
      "payment_date": "2019-12-12T21:32:18.000Z", 
      "payment_id": "8ac7a4a06efa4879016efd875f3872dc", 
      "payment_type": "CC.DB", 
      "reference_number": "prefix35", 
      "reference_payment_id": null, 
      "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'", 
      "shipping_information": false, 
      "status": "success", 
      "transaction_date": "2019-12-13T03:16:43.000Z", 
      "transaction_id": "6955PO", 
      "transaction_type": "pos_payment"
    }, 
    {
      "amount": 1, 
      "currency": "ZAR", 
      "customer_phone_number": null, 
      "email": null, 
      "payment_date": "2019-12-12T20:18:57.000Z", 
      "payment_id": "8ac7a49f6efad15d016efd44386c5dd8", 
      "payment_type": "CC.DB", 
      "reference_number": "prefix35", 
      "reference_payment_id": null, 
      "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'", 
      "shipping_information": false, 
      "status": "success", 
      "transaction_date": "2019-12-13T03:16:43.000Z", 
      "transaction_id": "6955PO", 
      "transaction_type": "pos_payment"
    }
  ], 
  "total_count": 665
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Get Payment History detail

Fetch a single payment history from Paysley

You can use the same GET method like in Payment History, but you have to add payment_id in the route parameter.

Request URL  
https://test.paysley.io/v2/payments/{payment_id}
Examples
curl -X GET https://test.paysley.io/v2/payments/{payment_id} \
--header "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests

url = "https://test.paysley.io/v2/payments/8ac7a4a26ff5c0c4016ff617ed2128fa99999999"

payload = {}
headers = {
  'Content-Type': ' application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://test.paysley.io/v2/payments/8ac7a4a26ff5c0c4016ff617ed2128fa99999999',
  'headers': {
    'Content-Type': ' application/json',
    'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
  }
};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payments/8ac7a4a26ff5c0c4016ff617ed2128fa99999999",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Content-Type:  application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"

url = URI("https://test.paysley.io/v2/payments/8ac7a4a26ff5c0c4016ff617ed2128fa99999999")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = " application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"

response = https.request(request)
puts response.read_body

Result Format
{
    "payment": {
        "transaction_type": "once-off",
        "payment_id": "8ac7a4a0701478cd017014fd894446c3",
        "transaction_id": "6954555OO",
        "customer_phone_number": "",
        "email": "example@example.com",
        "amount": 1,
        "currency": "ZAR",
        "reference_number": "1281919191",
        "shipping_information": false,
        "payment_type": "CC.RV",
        "transaction_date": "2020-02-05T10:48:23.000Z",
        "url": "",
        "status": "success",
        "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'",
        "payment_date": "2020-02-05T03:55:25.000Z",
        "reference_payment_id": "8ac7a4a1701475c2017014fd24255d52",
        "request_detail": {
            "payment_type": "Once-off transaction",
            "shipping_information": true
        }
    }
}
{
"message": "Your Payment history data not found",
"result": "failed"
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Refund

Refund a paid payment history from Paysley. You have to include the payment_id of the payment history you want to refund.

Body Params
Field Description
amount

required

number

The amount to be refunded to the customer

email

string

A refund receipt will be send to this email address if you add it.

mobile_number

string

A refund receipt will be send to this mobile number if you add it.

Request URL  
https://test.paysley.io/v2/refunds/{unique_id}
Request Body
{
"email": "example@example.com",
"amount": 1,
"mobile_number": "+12345678"
}

Examples
curl -X POST https://test.paysley.io/v2/refunds/{payment_id} \
--header "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests

url = "https://test.paysley.io/v2/refunds"

payload = "{\n\"email\": \"example@example.com\",\n\"amount\": 1,\n\"mobile_number\": \"+12345678\"\n}\n\n"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://test.paysley.io/v2/refunds',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
  },
  body: JSON.stringify({"email":"example@example.com","amount":1,"mobile_number":"+12345678"})

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/refunds",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\n\"email\": \"example@example.com\",\n\"amount\": 1,\n\"mobile_number\": \"+12345678\"\n}\n\n",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"

url = URI("https://test.paysley.io/v2/refunds")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
request.body = "{\n\"email\": \"example@example.com\",\n\"amount\": 1,\n\"mobile_number\": \"+12345678\"\n}\n\n"

response = https.request(request)
puts response.read_body

Result Format
{
  "amount": 45, 
  "balance": 31, 
  "currency": "ZAR", 
  "email": "example@example.com", 
  "mobile_number": "", 
  "payment_id": "8ac7a49f70664e4f01706677b1e64a2e", 
  "ref_number": "000211582016283", 
  "refund_date": "2020-02-21T06:38:05.000Z", 
  "refunded_amount": 1, 
  "shipping_information": true, 
  "status": "refund", 
  "transaction_id": 495, 
  "transaction_type": "once-off"
}
{
    "result": "failed",
    "message": "Payment not found."
}
{
    "is_valid": false,
    "error_field": "amount",
    "error_message": "amount is required.",
    "result": "failed"
}

Request Samples
Loading...
Capture

Capture a pre-authorization payment. You have to include the payment_id of the payment history you want to capture.

Body Params
Field Description
amount

required

number

The amount to be captured, cannot more than the actual payment.

Request URL  
https://test.paysley.io/v2/captures/{payment_id}
Request Body
{
    "amount": 10
}

Examples
curl -X POST https://test.paysley.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0" \
--data '{
    "amount": 10
}'
import requests
import json

url = "https://test.paysley.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71"

payload = json.dumps( {
    "amount": 10
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://test.paysley.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0'
    },
    body: JSON.stringify({
        "amount": 10
    })

};
request(options, function (error, response) { 
    if (error) throw new Error(error);
    console.log(response.body);
});
$curl = curl_init();

$data = array(
    "amount" => 10
);
$data = json_encode($data);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
require "uri"
require "net/http"
require 'json'

url = URI("https://test.paysley.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
request.body = {
    amount: 10
}.to_json

response = https.request(request)
puts response.read_body

Result Format
{
    "transaction_type": "once-off",
    "payment_id": "8ac7a4a07297e42e01729955d6f40fa2",
    "transaction_id": "171OO",
    "captured_amount": 10,
    "amount": 1500.12,
    "balance": 10,
    "currency": "ZAR",
    "ref_number": "123",
    "shipping_information": true,
    "status": "capture",
    "capture_date": "2020-06-09T13:47:19.000Z"
}
{
    "result": "failed",
    "message": "Payment not found."
}

Request Samples
Loading...
End Subscription

Cancel subscription for already paid of the payment history with type scheduled. You have to include the payment_id of the scheduled payment history you want to cancel.

Request URL  
https://test.paysley.io/v2/payments/subscription/{payment_id}
Examples
curl -X POST https://test.paysley.io/v2/payments/subscription/8ac7a4a07546f39c01754a2cb5d13fae 
-H "Content-Type: application/json" \
-H "Authorization: Bearer py_live_PTkwpfHxUN39nuHWQ0h" \
import requests
import json

url = "https://test.paysley.io/v2/payments/subscription/8ac7a4a07546f39c01754a2cb5d13fae"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer py_live_PTkwpfHxUN39nuHWQ0h'
}

response = requests.request("DELETE", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
var request = require("request");

var options = {
    method: "DELETE",
    url: "https://test.paysley.io/v2/payments/subscription/8ac7a4a07546f39c01754a2cb5d13fae",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer py_live_PTkwpfHxUN39nuHWQ0h"
    },
};
request(options, function (error, response) { 
    if (error) throw new Error(error);
    console.log(response.body);
});
require "uri"
require "net/http"
require "json"

url = URI("https://test.paysley.io/v2/payments/subscription/8ac7a4a07546f39c01754a2cb5d13fae")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer py_live_PTkwpfHxUN39nuHWQ0h"

response = https.request(request)
puts response.read_body
$curl = curl_init();


curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.paysley.io/v2/payments/subscription/8ac7a49f7297dc2701729954fc4c1f71",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "Authorization: Bearer py_test_A83ucDEekfzqOATsxfrj"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Result Format
{
    "transaction_type": "scheduled",
    "payment_id": "8ac7a4a07546f39c01754a2cb5d13fae",
    "email": "example@example.com",
    "mobile_number": "+12345678901",
    "amount": 1,
    "currency": "ZAR",
    "ref_number": "Paysley End Subscription",
    "status": "end_subscription"
}
{
    "result": "failed",
    "message": "Payment is not found."
}

Request Samples
Loading...