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.
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:
- The URL is https://live.paysley.io/.
- Access key have the prefix py_live_.
- Connect your application with a merchant.
- Change your status application to Published.
- 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.
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.) |
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, 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 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" 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/" |
payment_frequency |
string
The frequency for the payment request. Available frequency are "ONE-TIME", "WEEKLY", "MONTHLY", "QUARTERLY", "YEARLY". The default value is ONE-TIME. |
payment_start_date
required with condition |
string
Payment start date , requested if payment_frequency is not "ONE-TIME". The value must follow the ISO8601 standard (ex:"2023-08-09T16:59:59.000Z"). Default value is empty |
initial_payment_amount |
number
Initial payment amount, requested if payment_frequency is not "ONE-TIME". Default value is empty. |
total_number_of_payments |
number
Total payments of recurring for customer, requested if payment_frequency is not "ONE-TIME". Default value is empty. |
cart_items |
array of object
Additional cart items that will be created for this payment the parameter must be an array of objects with "name", "qty" and "sales_price" property.
|
shipping_charges |
number
The shipping amount for this payment request |
shipping_tax |
number
The shipping tax for this payment request |
shipping_address |
object
Additional shipping address
|
payment_fee_enabled |
boolean
default will be always true if no payment_fee_enabled was added to parameter, set to false if you dont want payment fee added to the current payment request |
ach_fee_enabled |
boolean
default will be always true if no ach_fee_enabled was added to parameter, set to false if you dont want ach fee added to the current payment request |
surcharge_fee_enabled |
boolean
default will be always true if no surcharge_fee_enabled was added to parameter, set to false if you dont want surcharge fee added to the current payment request |
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": "USD", "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"], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_date": "", "initial_payment_amount": "", "total_number_of_payments": "", "payment_fee_enabled": false, "ach_fee_enabled": false, "surcharge_fee_enabled": false }
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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_date": "", "initial_payment_amount": "", "total_number_of_payments": "", "payment_fee_enabled": false, "ach_fee_enabled": false, "surcharge_fee_enabled": false }'
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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_date": "", "initial_payment_amount": "", "total_number_of_payments": "" } ) 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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_date": "", "initial_payment_amount": "", "total_number_of_payments": "" }) }; 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" => "USD", "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" ], "expiry_date" => "", "payment_frequency" => "ONE-TIME", "payment_start_date" => "", "initial_payment_amount" => "", "total_number_of_payments" => "" ); $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: "USD", 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" ], expiry_date: "", payment_frequency: "ONE-TIME", payment_start_date: "", initial_payment_amount: "", total_number_of_payments: "" }.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", "payment_start_date": "", "initial_payment_amount": "", "total_number_of_payments": "" }
{ "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
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.
Please note that you will not be allowed to edit a transaction that already has a payment history.
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": "USD", "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"], "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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_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": "USD", "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" ], "expiry_date": "", "payment_frequency": "ONE-TIME", "payment_start_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" => "USD", "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" ], "expiry_date" => "", "payment_frequency" =>"ONE-TIME", "payment_start_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: "USD", 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" ], expiry_date: "", payment_frequency" "ONE-TIME", payment_start_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
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
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
The payment response is sent via the payment response URL that you provided in your payment request.We send a JSON response in a POST parameter called response.On your payment response provided URL you will need to check for a post parameter called response and read the JSON payload contained within the post variable.
Two possible result codes of NOK for failure in the payment attempt and ACK for a successful payment.
Sample Payment Response
Field | Description |
---|---|
response | string (JSON stringify) |
{
"response":'{\n' +
' "status": "ACK",\n' +
' "result": "ACK",\n' +
' "payment_id": "cs2u7fv0i4793pdn8g20",\n' +
' "transaction_id": "1072539PO",\n' +
' "reference_number": "123",\n' +
' "payment_type": "CC.DB",\n' +
' "currency": "USD",\n' +
' "amount": 15,\n' +
' "result_code": 100,\n' +
' "result_description": "Transaction success.",\n' +
' "payment_frequency": "one-time",\n' +
' "email": "example@example.com",\n' +
' "mobile_no": ""\n' +
'}'
}
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
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
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
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 |
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
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
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 DELETE 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 => "DELETE", 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
Create a POS payment link with this feature.
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.
You can create one POS link for many payments.
Create a POS payment link for the merchant. One merchant can only have one POS link.
Body Params
Field | Description |
---|---|
currency
|
array
The currency of this payment request in 3 digit ISO format Example: ["USD","ZAR"] |
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/" |
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" |
tax_id
|
string
Tax profile ID to calculate the tax amount for this payment. If it does not exist, the amount value will be tax free. |
additional_info
|
object
Add additional notes for this payment. |
additional_info_text
|
object
Enable customer to input additional info using a text input. |
additional_info_dropdown
|
object
Enable customer to input additional info by selecting an option from a select input. |
tip_enabled
|
boolean
Use "true" if you want the customer to be able to input tip amount. |
moto_enabled
|
boolean
Enable MOTO card mode which have no additional authentication on payment widget |
share_button_enabled
|
boolean
Enable share button on payment page. Customer will be able to share the payment request to social media such as Facebook, Twitter, etc |
auto_generate_ref_number
|
boolean
Use "true" if you want the payment reference number to be auto generated. Else, customer will need to input reference number manually. |
ref_number_suffix
|
number
Add a suffix to reference number when reference number is auto generated. |
ref_number_prefix
|
string
Add a prefix to reference number when reference number is auto generated. |
payment_methods
|
array
Add optional payment methods that can be used to pay this request. You can add "APPLE_PAY", "GOOGLE_PAY", or "AMEX" in a single array. |
repeat_payment
|
boolean
Use "true" if you want the customer to be able to make recurring payment. |
Request URL
https://test.paysley.io/v2/posRequest Body
{ "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["ZAR", "USD", "EUR"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "moto_enabled": true, "share_button_enabled": true, "auto_generate_ref_number": true, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"], "repeat_payment": true }
Examples
curl -X POST https://test.paysley.io/v2/pos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer py_live_9Au2ABAwToHDfMf1kiwr" \ --data '{ "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["USD"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "moto_enabled": true, "share_button_enabled": true, "auto_generate_ref_number": true, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment": true }'
import requests import json url = "https://test.paysley.io/v2/pos" payload = json.dumps( { "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["USD"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": True, "moto_enabled": True, "share_button_enabled": True, "auto_generate_ref_number": True, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment": true } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer py_live_9Au2ABAwToHDfMf1kiwr' } 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/pos", headers: { "Content-Type": "application/json", "Authorization": "Bearer py_live_9Au2ABAwToHDfMf1kiwr" }, body: JSON.stringify({ redirect_url: "https://paysley.com", response_url: "https://yourshop.com/response_handler", cancel_url: "https://yourshop.com", currency: ["USD"], tax_id: "", additional_info: {"Product": "Shirt", "Color": "Red"}, additional_info_text: {"text": "input text on front"}, additional_info_dropdown: { size: "S, M, L, XL" }, tip_enabled: true, moto_enabled: true, share_button_enabled: true, auto_generate_ref_number: true, ref_number_suffix: 1, ref_number_prefix: "PY", payment_methods: ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] repeat_payment: true }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "redirect_url" => "https://paysley.com", "response_url" => "https://yourshop.com/response_handler", "cancel_url" => "https://yourshop.com", "currency" => ["USD"], "tax_id" => "", "additional_info" => array( "Product" => "Shirt", "Color" => "Red" ), "additional_info_text" => array( "text" => "input text on front" ), "additional_info_dropdown" => array( "size" => "S, M, L, XL" ), "tip_enabled" => true, "moto_enabled" => true, "share_button_enabled" => true, "auto_generate_ref_number" => true, "ref_number_suffix" => 1, "ref_number_prefix" => "PY", "payment_methods" => ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment"=> true ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/pos", 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_live_9Au2ABAwToHDfMf1kiwr" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/pos") 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_live_9Au2ABAwToHDfMf1kiwr" request.body = { redirect_url: "https://paysley.com", response_url: "https://yourshop.com/response_handler", cancel_url: "https://yourshop.com", currency: ["USD"], tax_id: "", additional_info: {"Product": "Shirt", "Color": "Red"}, additional_info_text: {"text": "input text on front"}, additional_info_dropdown: { size: "S, M, L, XL" }, tip_enabled: true, moto_enabled: true, share_button_enabled: true, auto_generate_ref_number: true, ref_number_suffix: 1, ref_number_prefix: "PY", payment_methods: ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] repeat_payment: true }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "auto_generate_ref_number": true, "ref_number_prefix": "PY", "ref_number_suffix": 1, "additional_info": { "Product": "Shirt", "Color": "Red" }, "additional_info_text": { "text": "input text on front" }, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "currency": [ "ZAR", "USD", "EUR" ], "moto_enabled": true, "share_button_enabled": true, "tax_id": "", "payment_methods": [ "APPLE_PAY", "GOOGLE_PAY", "AMEX" ], "cancel_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "redirect_url": "https://paysley.com", "repeat_payment": true, "db_transaction_id": "111PO", "db_payment_url": "https://paystage.paysley.com/pos_link/FIIZBbASgUeJ7sRrJE3eRA", "db_short_url": "https://s.mpaid.us/F7QSR", "db_qrcode_link": "https://py-qrcodes.s3.amazonaws.com/stage/pos/httpssmpaidusF7QSR.png", "pa_transaction_id": "112PO", "pa_payment_url": "https://paystage.paysley.com/pos_link/X2x1fAMib0N0LsidbiB9xw", "pa_short_url": "https://s.mpaid.us/rby8Z", "pa_qrcode_link": "https://py-qrcodes.s3.amazonaws.com/stage/pos/httpssmpaidusrby8Z.png" }
{ "is_valid": false, "error_field": "tax_id", "error_message": "tax_id is not valid" }
Request Samples
Update an existing POS payment link for the merchant.
Body Params
Field | Description |
---|---|
currency
|
array
The currency of this payment request in 3 digit ISO format Example: ["USD","ZAR"] |
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/" |
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" |
tax_id
|
string
Tax profile ID to calculate the tax amount for this payment. If it does not exist, the amount value will be tax free. |
additional_info
|
object
Add additional notes for this payment. |
additional_info_text
|
object
Enable customer to input additional info using a text input. |
additional_info_dropdown
|
object
Enable customer to input additional info by selecting an option from a select input. |
tip_enabled
|
boolean
Use "true" if you want the customer to be able to input tip amount. |
moto_enabled
|
boolean
Enable MOTO card mode which have no additional authentication on payment widget |
share_button_enabled
|
boolean
Enable share button on payment page. Customer will be able to share the payment request to social media such as Facebook, Twitter, etc |
auto_generate_ref_number
|
boolean
Use "true" if you want the payment reference number to be auto generated. Else, customer will need to input reference number manually. |
ref_number_suffix
|
number
Add a suffix to reference number when reference number is auto generated. |
ref_number_prefix
|
string
Add a prefix to reference number when reference number is auto generated. |
payment_methods
|
array
Add optional payment methods that can be used to pay this request. You can add "APPLE_PAY", "GOOGLE_PAY" or "AMEX" in a single array. |
repeat_payment
|
boolean
Use "true" if you want the customer to be able to make recurring payment. |
Request URL
https://test.paysley.io/v2/posRequest Body
{ "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["USD"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "moto_enabled": true, "share_button_enabled": true, "auto_generate_ref_number": true, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"], "repeat_payment": true }
Examples
curl -X PUT https://test.paysley.io/v2/pos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer py_live_9Au2ABAwToHDfMf1kiwr" \ --data '{ "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["USD"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "moto_enabled": true, "share_button_enabled": true, "auto_generate_ref_number": true, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment": true }'
import requests import json url = "https://test.paysley.io/v2/pos" payload = json.dumps( { "redirect_url": "https://paysley.com", "response_url": "https://yourshop.com/response_handler", "cancel_url": "https://yourshop.com", "currency": ["USD"], "tax_id": "", "additional_info": {"Product" : "Shirt", "Color": "Red"}, "additional_info_text": {"text" : "input text on front"}, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": True, "moto_enabled": True, "share_button_enabled": True, "auto_generate_ref_number": True, "ref_number_suffix": 1, "ref_number_prefix": "PY", "payment_methods": ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment": true } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer py_live_9Au2ABAwToHDfMf1kiwr' } 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/pos", headers: { "Content-Type": "application/json", "Authorization": "Bearer py_live_9Au2ABAwToHDfMf1kiwr" }, body: JSON.stringify({ redirect_url: "https://paysley.com", response_url: "https://yourshop.com/response_handler", cancel_url: "https://yourshop.com", currency: ["USD"], tax_id: "", additional_info: {"Product": "Shirt", "Color": "Red"}, additional_info_text: {"text": "input text on front"}, additional_info_dropdown: { size: "S, M, L, XL" }, tip_enabled: true, moto_enabled: true, share_button_enabled: true, auto_generate_ref_number: true, ref_number_suffix: 1, ref_number_prefix: "PY", payment_methods: ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] repeat_payment: true }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "redirect_url" => "https://paysley.com", "response_url" => "https://yourshop.com/response_handler", "cancel_url" => "https://yourshop.com", "currency" => ["USD"], "tax_id" => "", "additional_info" => array( "Product" => "Shirt", "Color" => "Red" ), "additional_info_text" => array( "text" => "input text on front" ), "additional_info_dropdown" => array( "size" => "S, M, L, XL" ), "tip_enabled" => true, "moto_enabled" => true, "share_button_enabled" => true, "auto_generate_ref_number" => true, "ref_number_suffix" => 1, "ref_number_prefix" => "PY", "payment_methods" => ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] "repeat_payment"=> true ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/pos", 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_live_9Au2ABAwToHDfMf1kiwr" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/pos") 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_live_9Au2ABAwToHDfMf1kiwr" request.body = { redirect_url: "https://paysley.com", response_url: "https://yourshop.com/response_handler", cancel_url: "https://yourshop.com", currency: ["USD"], tax_id: "", additional_info: {"Product": "Shirt", "Color": "Red"}, additional_info_text: {"text": "input text on front"}, additional_info_dropdown: { size: "S, M, L, XL" }, tip_enabled: true, moto_enabled: true, share_button_enabled: true, auto_generate_ref_number: true, ref_number_suffix: 1, ref_number_prefix: "PY", payment_methods: ["GOOGLE_PAY", "APPLE_PAY", "AMEX"] repeat_payment: true }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "auto_generate_ref_number": true, "ref_number_prefix": "PY", "ref_number_suffix": 1, "additional_info": { "Product": "Shirt", "Color": "Red" }, "additional_info_text": { "text": "input text on front" }, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "currency": [ "ZAR", "USD", "EUR" ], "moto_enabled": true, "share_button_enabled": true, "tax_id": "", "payment_methods": [ "APPLE_PAY", "GOOGLE_PAY", "AMEX" ], "cancel_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "redirect_url": "https://paysley.com", "repeat_payment": true, "db_transaction_id": "111PO", "db_payment_url": "https://paystage.paysley.com/pos_link/FIIZBbASgUeJ7sRrJE3eRA", "db_short_url": "https://s.mpaid.us/F7QSR", "db_qrcode_link": "https://py-qrcodes.s3.amazonaws.com/stage/pos/httpssmpaidusF7QSR.png", "pa_transaction_id": "112PO", "pa_payment_url": "https://paystage.paysley.com/pos_link/X2x1fAMib0N0LsidbiB9xw", "pa_short_url": "https://s.mpaid.us/rby8Z", "pa_qrcode_link": "https://py-qrcodes.s3.amazonaws.com/stage/pos/httpssmpaidusrby8Z.png" }
{ "is_valid": false, "error_field": "tax_id", "error_message": "tax_id is not valid" }
Request Samples
Get existing POS link for the connected merchant.
Request URL
https://test.paysley.io/v2/posExamples
curl -X GET https://test.paysley.io/v2/pos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer py_test_w3Lwv3CZIZzye4cYxxr0"
import requests import json url = "https://test.paysley.io/v2/pos" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer py_test_w3Lwv3CZIZzye4cYxxr0' } response = requests.request("GET", url, headers=headers) print(response.text.encode('utf8'))
var request = require("request"); var options = { method: "GET", url: "https://test.paysley.io/v2/pos", 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/pos", 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" require "json" url = URI("https://test.paysley.io/v2/pos") 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
{ "result": "success", "auto_generate_ref_number": true, "ref_number_prefix": "PY", "ref_number_suffix": 1, "additional_info": { "Product": "Shirt", "Color": "Red" }, "additional_info_text": { "text": "input text on front" }, "additional_info_dropdown": { "size": "S, M, L, XL" }, "tip_enabled": true, "currency": [ "ZAR", "USD", "EUR" ], "moto_enabled": true, "share_button_enabled": true, "tax_id": "", "payment_methods": [ "APPLE_PAY", "GOOGLE_PAY", "AMEX" ], "cancel_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "redirect_url": "https://paysley.com", "repeat_payment": true, "db_transaction_id": "111PO", "db_payment_url": "https://paystage.paysley.com/pos_link/FIIZBbASgUeJ7sRrJE3eRA", "pa_transaction_id": "112PO", "pa_payment_url": "https://paystage.paysley.com/pos_link/X2x1fAMib0N0LsidbiB9xw" }
{ "result": "failed", "message": "Merchant DB POS link not found." }
Request Samples
Generate a POS link with pre-filled parameters for the connected merchant.
Body Params
Field | Description |
---|---|
currency |
string
The currency of this payment request in 3 digit ISO format Example: "USD" |
amount |
string
The payment amount for this payment link. |
tip_amount |
string
The tip amount for this payment link. |
payment_type |
string
The payment type of this POS link. You can select between "PA" and "DB" |
reference |
string
You can input reference number for this link |
cancel_url |
string
The url where customer will redirected when customer click cancel button on payment page. Example: "https://mywebsite.com" |
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/" |
return_url |
string
The URL that will be set for "return to shop" button. |
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/" |
additional_text_fields |
object
Additional text input generated for this link. |
additional_dropdown_fields |
object
Additional select input for this link. |
cart_items |
array of object
Additional cart items that will be created for this payment the parameter must be an array of objects with "name" and "qty" property. Example:
|
payment_frequency |
string
Payment frequency to be set as recurring payment. Available option are "WEEKLY","MONTHLY""QUARTERLY","YEARLY" . Leave it if you decide to set as non recurring payment |
payment_start_date
Required with condition |
string
Date when payment to be started. Required if payment_frequency not empty |
string
Customer email. Example: "john@doe.com" |
|
shipping_charges |
number
The shipping amount for this payment link. |
shipping_address |
object
Additional shipping address
|
payment_fee_enabled |
boolean
default will be always true if no payment_fee_enabled was added to parameter, set to false if you dont want payment fee added to the current payment request |
ach_fee_enabled |
boolean
default will be always true if no ach_fee_enabled was added to parameter, set to false if you dont want ach fee added to the current payment request |
surcharge_fee_enabled |
boolean
default will be always true if no surcharge_fee_enabled was added to parameter, set to false if you dont want surcharge fee added to the current payment request |
Request URL
https://test.paysley.io/v2/pos/generate-linkRequest Body
{ "payment_type": "DB", "tip_amount": 0, "amount": 50.33, "reference": "RED-SHIRT-123", "currency": "ZAR", "return_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "payment_frequency": "WEEKLY", "payment_start_date": "2023-08-09T23:59:59.000Z", "cart_items": [{ "name": "Blue Shirt XL", "qty": 1 }, { "name": "Black Short Pant XL", "qty": 3 }], "additional_text_fields": { "text": "Hey guys" }, "additional_dropdown_fields": { "size": "XL" }, "payment_fee_enabled": false, "ach_fee_enabled": false, "surcharge_fee_enabled": false }
Examples
curl -X PUT https://test.paysley.io/v2/pos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer py_live_9Au2ABAwToHDfMf1kiwr" \ --data '{ "payment_type": "DB", "tip_amount": 0, "amount": 50.33, "reference": "RED-SHIRT-123", "currency": "ZAR", "return_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "payment_frequency": "WEEKLY", "payment_start_date": "2023-08-09T23:59:59.000Z", "cart_items": [{ "name": "Blue Shirt XL", "qty": 1 }, { "name": "Black Short Pant XL", "qty": 3 }], "additional_text_fields": { "text": "Hey guys" }, "additional_dropdown_fields": { "size": "XL" }, "payment_fee_enabled": false, "ach_fee_enabled": false, "surcharge_fee_enabled: false }'
import requests import json url = "https://test.paysley.io/v2/pos/generate-link" payload = json.dumps( { "payment_type": "DB", "tip_amount": 0, "amount": 50.33, "reference": "RED-SHIRT-123", "currency": "ZAR", "return_url": "https://yourshop.com", "response_url": "https://yourshop.com/response_handler", "payment_frequency": "WEEKLY", "payment_start_date": "2023-08-09T23:59:59.000Z", "cart_items": [{ "name": "Blue Shirt XL", "qty": 1 }, { "name": "Black Short Pant XL", "qty": 3 }], "additional_text_fields": { "text": "Hey guys" }, "additional_dropdown_fields": { "size": "XL" }, "payment_fee_enabled": false, "ach_fee_enabled": false, "surcharge_fee_enabled": false } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer py_live_9Au2ABAwToHDfMf1kiwr' } 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/pos/generate-link", headers: { "Content-Type": "application/json", "Authorization": "Bearer py_live_9Au2ABAwToHDfMf1kiwr" }, body: JSON.stringify({ payment_type: "DB", tip_amount: 0, amount: 50.33, reference: "RED-SHIRT-123", currency: "ZAR", return_url: "https://yourshop.com", response_url: "https://yourshop.com/response_handler", payment_frequency: "WEEKLY", payment_start_date: "2023-08-09T23:59:59.000Z", cart_items: [{ name: "Blue Shirt XL", qty: 1 }, { name: "Black Short Pant XL", qty: 3 }], additional_text_fields: { text: "Hey guys" }, additional_dropdown_fields: { size: "XL" }, payment_fee_enabled: false, ach_fee_enabled: false, surcharge_fee_enabled: false }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "payment_type" => "DB", "tip_amount" => 0, "amount" => 50.33, "reference" => "RED-SHIRT-123", "currency" => "ZAR", "return_url" => "https://yourshop.com", "response_url" => "https://yourshop.com/response_handler", "payment_frequency"=> "WEEKLY", "payment_start_date"=> "2023-08-09T23:59:59.000Z", "cart_items" => [ array( "name" => "Blue Shirt XL", "qty" => 1 ), array( "name" => "Black Short Pant XL", "qty" => 3 ) ], "additional_text_fields" => array( "text" => "Hey guys" ), "additional_dropdown_fields" => array( "size" => "XL" ), "payment_fee_enabled" => false, "ach_fee_enabled" => false, "surcharge_fee_enabled" => false ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/pos/generate-link", 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_live_9Au2ABAwToHDfMf1kiwr" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/pos/generate-link") 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_live_9Au2ABAwToHDfMf1kiwr" request.body = { payment_type: "DB", tip_amount: 0, amount: 50.33, reference: "RED-SHIRT-123", currency: "ZAR", return_url: "https://yourshop.com", response_url: "https://yourshop.com/response_handler", payment_frequency: "WEEKLY", payment_start_date: "2023-08-09T23:59:59.000Z", cart_items: [{ name: "Blue Shirt XL", qty: 1 }, { name: "Black Short Pant XL", qty: 3 }], additional_text_fields: { text: "Hey guys" }, additional_dropdown_fields: { size: "XL" }, payment_fee_enabled: false, ach_fee_enabled: false, surcharge_fee_enabled: false }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "long_url": "https://paystage.paysley.com/pos_link/FIIZBbASgUeJ7sRrJE3eRA?q=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXltZW50X3JlcXVlc3RfY3JpdGVyaWEiOnsidGlwX2Ftb3VudCI6MCwiYW1vdW50Ijo1MC4zMywicmVmZXJlbmNlIjoiUkVELVNISVJULTEyMyIsImN1cnJlbmN5IjoiWkFSIiwicmV0dXJuX3VybCI6Imh0dHBzOi8veW91cnNob3AuY29tIiwicmVzcG9uc2VfdXJsIjoiaHR0cHM6Ly95b3Vyc2hvcC5jb20vcmVzcG9uc2VfaGFuZGxlciIsImNhcnRfaXRlbXMiOlt7Im5hbWUiOiJCbHVlIFNoaXJ0IFhMIiwicXR5IjoxfSx7Im5hbWUiOiJCbGFjayBTaG9ydCBQYW50IFhMIiwicXR5IjozfV0sImFkZGl0aW9uYWxfdGV4dF9maWVsZHMiOnsidGV4dCI6IkhleSBndXlzIn0sImFkZGl0aW9uYWxfZHJvcGRvd25fZmllbGRzIjp7InNpemUiOiJYTCJ9LCJhY2Nlc3Nfa2V5X2lkIjoxfSwiaWF0IjoxNTg1ODAxOTAwfQ.FhkUuFU9OHguYNLZU0JNCqawhSytzdeU9xgnk8BeE20", "short_url": "https://s.mpaid.us/gici3", "qrcode_link": "https://py-qrcodes.s3.amazonaws.com/stage/pos/httpssmpaidusgici3.png" }
{ "is_valid": false, "error_field": "currency", "error_message": "The POS link does not support the specified currency", "result": "failed" }
Request Samples
You can get, create, edit and delete customer with this feature.
Create a new customer for the merchant.
Body Params
Field | Description |
---|---|
email
required |
string
Customer's email. You must fill either email or mobile_no field. Example : "john@doe.com". |
mobile_no
required |
string
Customer's mobile number. You must fill either email or mobile_no field. Example : "+1234567890". |
customer_group_id
|
string
Customer's group id. Example : "K1Z2J2Zl". |
salutation
|
string
Customer's salutation. for example you can put "Mr.","Mrs.","Ms.". |
first_name
required with condition |
string
Customer's first name. |
last_name
|
string
Customer's last name. |
company_name
required with condition |
string
Customer's company name. |
ein_code
|
string
Customer's ein code. |
listing_type
required with condition |
string
Customer's listing type. Available option are "individual" and "company". |
address_line1
|
string
Customer's address line 1. |
address_line2
|
string
Customer's address line 2. |
description
|
string
Customer's specific description. |
country_iso
|
string
Customer's country ISO. Example : "US". |
state
|
string
Customer's state. Example : "CA". |
city
|
string
Customer's city. Example : "Los Angeles". |
postal_code
|
string
Customer's postal code. Example : "12345". |
reference_number
|
string
Customer's reference number. Example : "12345". |
additional_value
|
json
Customer's additional value. Example : {"age": 20, "gender": "male"}. |
profile_picture_base64 |
string
Profile picture for customer, Example : "base64string_image" |
Request URL
https://test.paysley.io/v2/customersRequest Body
{ "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "address_line1": "", "address_line2": "", "additional_value": {"age": 20, "gender": "male"}, "profile_picture_base64": "base64string_image" }
Examples
curl -X POST https://test.paysley.io/v2/customers \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" }'
import requests import json url = "https://test.paysley.io/v2/customers" payload = json.dumps( { "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKEN" }, body: JSON.stringify({ "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "email" => "john@doe.com", "mobile_no" => "1234567890", "customer_group_id" => "", "salutation" => "Mr.", "first_name" => "John", "last_name" => "Doe", "company_name" => "", "ein_code" => "", "listing_type" => "individual", "description" => "", "country_iso" => "", "state" => "", "city" => "", "postal_code" => "", "reference_number" => "", "additional_value" => array("age" => 20, "gender" => "male"), "address_line1" => "", "address_line2" => "", "profile_picture_base64" => "some base 64 string image" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/customers", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers") 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 YOUR_ACCESS_TOKEN" request.body = { "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2: "", "profile_picture_base64": "some base 64 string image" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "customer_group_id": null, "email": "john@doe.com", "mobile_no": "1234567890", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company": null, "ein_code": null, "listing_type": "individual", "description": null, "country_iso": null, "country_name": null, "state": null, "city": null, "postal_code": null, "reference_number": null, "additional_value": null, "address_line1": null, "address_line2": null, "customer_images": [ { "id": 20, "customer_id": 779, "file_name": "Nobody-Nobody2-1698745934449.png", "url": null, "ext": ".png", "type": "profile_picture", "uploaded_at": "2023-10-31T09:52:18.000Z", "file_url": "image_url_string" } ] }
{ "response_code": 422, "is_valid": false, "errors": [ { "message": "Email is already registered to an existing customer.", "field": "email" } ] }
Request Samples
You can get a list of customer using our GET method.
Here are the available query string parameters to help you fetch the right payment history:
Params | Description |
---|---|
page | number the default value is 1 |
limit | number Limit the amount of items fetched from customer. The default value is 10 |
keywords | string Search for a customer that has the specified keyword in first_name, last_name, company, email, and mobile_no |
sort | string the value is "ASC" or "DESC" |
Request URL
https://test.paysley.io/v2/customersExamples
curl -X GET https://test.paysley.io/v2/customers?page=1&limit=10 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUER_ACCESS_TOKEN"
import requests import json url = "https://test.paysley.io/v2/customers?page=1&limit=10" payload = {} headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUER_ACCESS_TOKEN' } 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/customers?page=1&limit=10", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUER_ACCESS_TOKEN" }, }; 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/customers?page=1&limit=10", 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 YOUER_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers?page=1&limit=10") 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 YOUER_ACCESS_TOKEN" response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "limit": 10, "page": 1, "page_count": 1, "total_count": 1, "customers": [ { "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "group_id": null, "salutation": "Mr.", "first_name": "John", "last_name": null, "company": null, "ein_code": null, "listing_type": "individual", "description": null, "country_iso": null, "country_name": null, "state": null, "city": null, "postal_code": null, "reference_number": null, "additional_value": { "age": 20, "gender": "male" }, "address_line1": null, "address_line2": null, } ] }
Request Samples
You can update the customer by using the same parameters from create a customer, but you have to add customer_id to the body.
Required Header:
- Authorization
Request URL
https://test.paysley.io/v2/customersRequest Body
{ "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "0", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "base64string_image" }
Examples
curl -X PUT https://test.paysley.io/v2/customers \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUER_ACCESS_TOKEN" \ --data '{ "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "0", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "0", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" }'
import requests import json url = "https://test.paysley.io/v2/customers" payload = json.dumps( { "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "0", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "0", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"} "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKEN" }, body: JSON.stringify({ "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "0", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "0", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 string image" }) };
$curl = curl_init(); $data = array( "customer_id" => "747", "email" => "john@doe.com", "mobile_no" => "+1234567890", "customer_group_id" => "0", "salutation" => "Mr.", "first_name" => "John", "last_name" => "Doe", "company_name": "0",, "ein_code": "", "listing_type": "individual", "description" => "", "country_iso" => "", "state" => "", "city" => "", "postal_code" => "", "reference_number" => "", "additional_value" => array("age" => 20, "gender" => "male"), "address_line1" => "", "address_line2" => "", "profile_picture_base64" => "some base 64 string image" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/customers", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers") 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 YOUR_ACCESS_TOKEN" request.body = { "customer_id": 747, "email": "john@doe.com", "mobile_no": "1234567890", "customer_group_id": "0", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company_name": "0", "ein_code": "", "listing_type": "individual", "description": "", "country_iso": "", "state": "", "city": "", "postal_code": "", "reference_number": "", "additional_value": {"age": 20, "gender": "male"}, "address_line1": "", "address_line2": "", "profile_picture_base64": "some base 64 image string" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "customer_id": "747", "customer_group_id": '0', "email": "john@doe.com", "mobile_no": "1234567890", "salutation": "Mr.", "first_name": "John", "last_name": "Doe", "company": null, "ein_code": null, "listing_type": "individual", "description": null, "country_iso": null, "country_name": null, "state": null, "city": null, "postal_code": null, "reference_number": null, "additional_value": {"age": 20, "gender": "male"}, "address_line1": null, "address_line2": null, "customer_images": [ { "id": 20, "customer_id": 779, "file_name": "Nobody-Nobody2-1698745934449.png", "url": null, "ext": ".png", "type": "profile_picture", "uploaded_at": "2023-10-31T09:52:18.000Z", "file_url": "image_url_string" } ] }
{ "response_code": 422, "is_valid": false, "errors": [ { "message": "customer_id is required.", "field": [ "customer_id" ] } ] }
{ "message": "customer_id is not found." }
Request Samples
You can delete a customer by using customer_id at the end of url parameter, example :
{url_to_api}/customers/{customer_id}
Required Header :
- Authorization
Request URL
https://test.paysley.io/v2/customers/{customer_id}Result Format
{ "code": 200, "is_valid": true, "result": "success", "message": "Delete customer success!", "data": null }
{ "status_code": 404, "is_valid": false, "result": "error", "message": "customer not found!" }
Request Samples
You can get, create, edit and delete customer groups with this feature.
Create a new customer group for the customer.
Body Params
Field | Description |
---|---|
group_name
required |
string
Customer group's name. |
description
|
string
Customer group's specific description. |
Request URL
https://test.paysley.io/v2/customers/groupsRequest Body
{ "group_name" : "Card", "description" : "group for card" }
Examples
curl -X POST https://test.paysley.io/v2/customers/groups \ -H "Content-Type: application/json" \ -H "Authorization: Bearer TOUR_ACCESS_TOKEN" \ --data '{ "group_name" : "Card", "description" : "group for card" }'
import requests import json url = "https://test.paysley.io/v2/customers/groups" payload = json.dumps( { "group_name" : "Card", "description" : "group for card" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers/groups", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKEN" }, body: JSON.stringify({ "group_name" : "Card", "description" : "group for card" }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "group_name" => "Card", "description" => "group for card" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/customers/groups", 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 YOUR_CCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers/groups") 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 YOUR_ACCESS_TOKEN" request.body = { "group_name" : "Card", "description" : "group for card" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "customer_group_id": 1, "group_name": "card", "description": "group for card" }
{ "response_code": 422, "is_valid": false, "errors": [ { "message": "Group name already exists.", "field": "group_name" } ] }
Request Samples
You can get a list of customer group using our GET method.
Here are the available query string parameters to help you fetch the right payment history:
Params | Description |
---|---|
page | number the default value is 1 |
limit | number Limit the amount of items fetched from customer group. The default value is 10 |
keywords | string Search for a customer group that has the specified keyword in name |
Request URL
https://test.paysley.io/v2/customers/groupsExamples
curl -X GET https://test.paysley.io/v2/customers/groups?page=1&limit=10 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests import json url = "https://test.paysley.io/v2/customers/groups?page=1&limit=10" payload = {} headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers/groups?page=1&limit=10", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKEN" }, }; 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/customers/groups?page=1&limit=10", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers/groups?page=1&limit=10") 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 YOUR_ACCESS_TOKEN" response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "limit": 10, "page": 1, "page_count": 1, "total_count": 1, "customers_groups": [ { "group_id": 160, "name": "Card", "description": "group for card", "date_created": "2022-06-23T08:41:12.000Z" } ] }
Request Samples
You can update the customer group by using the same parameters from create a customer group, but you have to add customer_group_id to the body.
Request URL
https://test.paysley.io/v2/customers/groupsRequest Body
{ "customer_group_id" : 1, "group_name" : "Card", "description" : "group for card" }
Examples
curl -X PUT https://test.paysley.io/v2/customers/groups \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "customer_group_id" : 1, "group_name" : "Card", "description" : "group for card" }'
import requests import json url = "https://test.paysley.io/v2/customers/groups" payload = json.dumps( { "customer_group_id" : 1, "group_name" : "Card", "description" : "group for card" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers/groups", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKEN" }, body: JSON.stringify({ "customer_group_id" : 1, "group_name" : "Card", "description" : "group for card" }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "customer_group_id" => 1, "group_name" => "Card", "description" => "group for card" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/customers/groups", 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 YOUR_ACESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers/groups") 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 YOUR_ACCESS_TOKEN" request.body = { "customer_group_id" : 1, "group_name" : "Card", "description" : "group for card" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "customer_group_id": 1, "group_name": "Card", "description": "group for card" }
{ "is_valid": false, "errors": [ { "message": "customer_group_id is required.", "field": [ "customer_group_id" ] } ], "result": "failed" }
Request Samples
You can delete a customer group by using the DELETE method with a customer_group_id in the route parameter.
Required Header:
- Authorization
Request URL
https://test.paysley.io/v2/customers/groups/{customer_group_id}Examples
curl -X DELETE https://test.paysley.io/v2/customers/groups/1 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests import json url = "https://test.paysley.io/v2/customers/groups/1" payload = {} headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/customers/groups/1", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKENj" }, }; 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/customers/groups/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 => "DELETE", CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "Authorization: Bearer YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/customers/groups/1") 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 YOUR_ACCESS_TOKEN" response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "customer_group_id": "1" }
{ "response_code": 422, "message": "customer_group_id is not found." }
Request Samples
You can get, create, edit and delete product and services with this feature.
Create a new product & service for the merchant.
Body Params
Field | Description |
---|---|
name
required |
string
Product or Service name. Example : "Item 1". |
description
|
string
Product or Service description. |
sku
|
string
Product or Service sku. Example : "BRW-LAR-B678-HNM". |
category_id
required |
number
Product or Service category_id. Example : 1. |
type
required |
string
Product or Service type. Example : "product","service". |
manage_inventory
|
number
Use "1" if you want manage your inventory stock. |
unit_in_stock
|
number
Product or Service unit_in_stock. Example : 1. |
unit_low_stock
|
number
Product or Service unit_low_stock. Example : 1. |
unit_type
|
string
Product or Service unit_type. Example : "flat-rate","per-hour","per-item". |
tax_id
|
number
Tax profile ID to calculate the tax amount for this product and service. |
cost
|
number
Product or Service cost. Example : 1. |
sales_price
required |
number
Product or Service sales_price. Example : 1. |
Request URL
https://test.paysley.io/v2/products-servicesRequest Body
{ "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" }
Examples
curl -X POST https://test.paysley.io/v2/products-services \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" }'
import requests import json url = "https://test.paysley.io/v2/products-services" payload = json.dumps( { "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCES_TOKEN' } 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/products-services', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer YOUR_ACCESS_TOKEN', }, body: JSON.stringify({ name: 'Item 1', description: 'Description item 1', sku: 'BRW-LAR-B678-HNM', category_id: 1, type: 'product', manage_inventory: 0, unit_in_stock: 1, unit_low_stock: 1, unit_type: 'flat-rate', tax_id: '', cost: 1, sales_price: 1, image: '{path}/uploads/product-image.jpg', }), }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "name" => "Item 1", "description" => "Description item 1", "sku" => "BRW-LAR-B678-HNM", "category_id" => "1", "type" => "product", "manage_inventory" => "0", "unit_in_stock" => "1", "unit_low_stock" => "1", "unit_type" => "flat-rate", "tax_id" => "1", "cost" => "1", "sales_price" => "1", "image" => "{path}/uploads/product-image.jpg", ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/products-services", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require 'json' url = URI("https://test.paysley.io/v2/products-services") 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 YOUR_ACCESS_TOKEN" request.body = { "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 1, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": 1, "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "id": 995, "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "image": null, "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": null, "cost": 1, "sales_price": 1, "image": "product-service.png" }
{ "is_valid": false, "errors": [ { "message": "Product or service name already exists.", "field": "name" } ], "result": "failed" }
Request Samples
You can get a list of product and services using our GET method.
Here are the available query string parameters to help you fetch the right payment history:
Params | Description |
---|---|
page | number the default value is 1 |
limit | number Limit the amount of items fetched from product and services. The default value is 10 |
keywords | string Search for a product and services that has the specified keyword in name, category or type |
type | string the value is "product" or "service" |
sort | string the value is "ASC" or "DESC" |
Request URL
https://test.paysley.io/v2/products-servicesResult Format
{ "result": "success", "limit": 10, "page": 1, "page_count": 1, "total_count": 1, "product_services": [ { "id": 1, "name": "Item 1", "description": "Description item 1", "type": "product", "sku": "BRW-LAR-B678-HNM", "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "cost": "1.00", "sales_price": "1.00", "category": "Electronic", "tax_label": null, "tax_value": null, "image": null } ] }
Request Samples
You can update the product and service by using the same parameters from create a product and service, but you have to add id to the body.
Required Header:
- Authorization
Request URL
https://test.paysley.io/v2/products-servicesRequest Body
{ "id": "1", "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 1, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image" => "{path}/uploads/product-image.jpg" }
Examples
curl -X PUT https://test.paysley.io/v2/products-services \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "id": "1", "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" }'
import requests import json url = "https://test.paysley.io/v2/products-services" payload = json.dumps( { "id": "1", "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg", } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/products-services', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer YOUR_ACCESS_TOKEN', }, body: JSON.stringify({ id: "1", name: 'Item 1', description: 'Description item 1', sku: 'BRW-LAR-B678-HNM', category_id: 1, type: 'product', manage_inventory: 0, unit_in_stock: 1, unit_low_stock: 1, unit_type: 'flat-rate', tax_id: '', cost: 1, sales_price: 1, image: '{path}/uploads/product-image.jpg', }), }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "id" => "1", "name" => "Item 1", "description" => "Description item 1", "sku" => "BRW-LAR-B678-HNM", "category_id" => "1", "type" => "product", "manage_inventory" => "0", "unit_in_stock" => "1", "unit_low_stock" => "1", "unit_type" => "flat-rate", "tax_id" => "", "cost" => "1", "sales_price" => "1", "image" => "{path}/uploads/product-image.jpg" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/products-services", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require 'json' url = URI("https://test.paysley.io/v2/products-services") 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 YOUR_ACCESS_TOKEN" request.body = { "id": "1", "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": "", "cost": 1, "sales_price": 1, "image": "{path}/uploads/product-image.jpg" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "id": 1, "name": "Item 1", "description": "Description item 1", "sku": "BRW-LAR-B678-HNM", "category_id": 1, "type": "product", "image": null, "manage_inventory": 0, "unit_in_stock": 1, "unit_low_stock": 1, "unit_type": "flat-rate", "tax_id": null, "cost": 1, "sales_price": 1. "image": "product-service.png" }
{ "is_valid": false, "error_field": "id", "error_message": "product and service ID not found", "result": "failed" }
Request Samples
You can get, create, edit and delete product and service category with this feature.
Create a new category for the product and service.
Body Params
Field | Description |
---|---|
name
required |
string
Category name. Example : "Product Category". |
Request URL
https://test.paysley.io/v2/products-services/categoryRequest Body
{ "name": "Product Category" }
Examples
curl -X POST https://test.paysley.io/v2/products-services/category \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "name": "Product Category" }'
import requests import json url = "https://test.paysley.io/v2/products-services/category" payload = json.dumps( { "name": "Product Category" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCES_TOKEN' } 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/products-services/category', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer YOUR_ACCESS_TOKEN', }, body: JSON.stringify({ name: "Product Category" }), }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "name" => "Product Category" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/products-services/category", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require 'json' url = URI("https://test.paysley.io/v2/products-services/category") 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 YOUR_ACCESS_TOKEN" request.body = { "name": "Product Category" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "id": 1, "name": "Product Category" }
{ "is_valid": false, "error_field": "name", "error_message": "name is required", "result": "failed" }
Request Samples
You can get a list of product and services category using our GET method.
Here are the available query string parameters to help you fetch the right payment history:
Params | Description |
---|---|
page | number the default value is 1 |
limit | number Limit the amount of items fetched from category. The default value is 10 |
keywords | string Search for a catrgory that has the specified keyword in name/td> |
sort | string the value is "ASC" or "DESC" |
Request URL
https://test.paysley.io/v2/products-services/categoryExamples
curl -X GET https://test.paysley.io/v2/products-services/category?page=1&limit=10 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_TOKEN"
import requests import json url = "https://test.paysley.io/v2/products-services/category?page=1&limit=10" payload = {} headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_TOKEN' } 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/products-services/category?page=1&limit=10", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_TOKEN" }, }; 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/products-services/category?page=1&limit=10", 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: BearerYOUR_API_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/products-services/category?page=1&limit=10") 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 YOUR_API_TOKEN" response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "limit": 10, "page": 1, "page_count": 1, "total_count": 1, "categories": [ { "id": 1, "name": "Product Category" } ] }
Request Samples
You can update the category by using the same parameters from create a category, but you have to add category_id to the body.
Required Header:
- Authorization
Request URL
https://test.paysley.io/v2/products-services/categoryRequest Body
{ "category_id": 1, "name": "Product Category" }
Examples
curl -X PUT https://test.paysley.io/v2/products-services/category \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --data '{ "category_id": 1, "name": "Product Category" }'
import requests import json url = "https://test.paysley.io/v2/products-services/category" payload = json.dumps( { "category_id": 1, "name": "Product Category" } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCES_TOKEN' } 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/products-services/category', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer YOUR_ACCESS_TOKEN', }, body: JSON.stringify({ category_id: 1, name: "Product Category" }), }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init(); $data = array( "category_id" => 1, "name" => "Product Category" ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://test.paysley.io/v2/products-services/category", 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 YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require 'json' url = URI("https://test.paysley.io/v2/products-services/category") 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 YOUR_ACCESS_TOKEN" request.body = { "category_id": 1, "name": "Product Category" }.to_json response = https.request(request) puts response.read_body
Result Format
{ "id": 1, "name": "Product Category" }
{ "is_valid": false, "error_field": "name", "error_message": "name is required", "result": "failed" }
Request Samples
You can delete a category by using the DELETE method with a category_id in the route parameter.
Required Header:
- Authorization
Request URL
https://test.paysley.io/v2/products-services/category/{category_id}Examples
curl -X DELETE https://test.paysley.io/v2/products-services/category/1 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests import json url = "https://test.paysley.io/v2/products-services/category/1" payload = {} headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } 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/products-services/category/1", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_ACCESS_TOKENj" }, }; 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/products-services/category/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 => "DELETE", CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "Authorization: Bearer YOUR_ACCESS_TOKEN" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri" require "net/http" require "json" url = URI("https://test.paysley.io/v2/products-services/category/1") 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 YOUR_ACCESS_TOKEN" response = https.request(request) puts response.read_body
Result Format
{ "result": "success", "message": "Delete category product success" }