Introduction

The Mobipaid 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 Mobipaid API in test/development mode, which does not affect your live data or interact with the banking networks. The URL and API key you use to authenticate the request determines whether the request is live mode or test mode.

Authentication

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

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

Development mode specifications:

  • The URL is https://test.mobipaid.io/.
  • Access key have the prefix mp_test_.

Production mode specifications:

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

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

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

This is the example with CURL.

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

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

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

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

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

This payment request is intended for one time payment.

Create a Payment Request

Create a new single payment request.

Body Params
Field Description
request_methods

required

array

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

reference_number

 

string

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

email

required with condition

string

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

merchant_phone_number

 

string

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

mobile_number

required with condition

string

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

amount

required

number

The amount of payment for this request Example: 3

currency

required

string

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

fixed_amount

required

boolean

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

tax_id

 

number

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

template_id

 

number

The Email or SMS template you would like to use with this payment. When empty, the payment request will be send using merchant's default template. If merchant does not set the default template, it will automatically send Mobipaid'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", "NEDBANK_EFT" or "AMEX" 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 Mobipaid 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 Mobipaid 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 Mobipaid 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 Mobipaid 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://mymobipaidmerchant.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://mymobipaidmerchant.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

Required Header:

  • Authorization
Request URL  
https://test.mobipaid.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://mobipaid.com",
  "response_url" : "https://mobipaid.com",
  "cancel_url" : "https://mobipaid.com",
  "fixed_amount": true,
  "currency": "ZAR",
  "amount": 1500.12,
  "tax_id": "",
  "template_id": "",
  "moto_enabled": false, 
  "shipping_enabled": false, 
  "send_mms_invoice": true,
  "attach_invoice": true,
  "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
  "attach_receipt": true, 
  "receipt_file_type": "pdf",
  "payment_type": "DB",
  "payment_methods": ["APPLE_PAY", "GOOGLE_PAY", "NEDBANK_EFT", "AMEX"],
  "expiry_date": "",
  "payment_frequency": "ONE-TIME",
  "payment_start_date": ""
}

Examples
curl -X POST https://test.mobipaid.io/v2/payment-requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_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://mobipaid.com",
    "response_url" : "https://mobipaid.com",
    "cancel_url" : "https://mobipaid.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false,
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
        "AMEX"
    ],
    "expiry_date": ""
}'
import requests
import json

url = "https://test.mobipaid.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://mobipaid.com",
    "response_url" : "https://mobipaid.com",
    "cancel_url" : "https://mobipaid.com",
    "fixed_amount": True,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false,
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": True,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
         "AMEX"
    ],
    "expiry_date": ""
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payment-requests',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer mp_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://mobipaid.com",
        "response_url" : "https://mobipaid.com",
        "cancel_url" : "https://mobipaid.com",
        "fixed_amount": true,
        "currency": "ZAR",
        "amount": 1500.12,
        "tax_id": "",
        "template_id": "",
        "moto_enabled": false,
        "shipping_enabled": false,
        "send_mms_invoice": true,
        "attach_invoice": true,
        "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
        "attach_receipt": true,
        "receipt_file_type": "pdf",
        "payment_type": "DB",
        "payment_methods": [
            "APPLE_PAY",
            "GOOGLE_PAY",
            "NEDBANK_EFT",
            "AMEX"
        ],
        "expiry_date": ""
    })

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

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

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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://mobipaid.com",
    response_url: "https://mobipaid.com",
    cancel_url: "https://mobipaid.com",
    fixed_amount: true,
    currency: "ZAR",
    amount: 1500.12,
    tax_id: "",
    template_id: "",
    moto_enabled: false,
    shipping_enabled: false,
    send_mms_invoice: true,
    attach_invoice: true,
    invoice_url: "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    attach_receipt: true,
    receipt_file_type: "pdf",
    payment_type: "DB",
    payment_methods: [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
        "AMEX"
    ],
    expiry_date: ""
}.to_json

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

Result Format
{
  "amount": "1500.12", 
  "attach_invoice": true, 
  "attach_receipt": true, 
  "cancel_url": "https://google.com", 
  "created_at": "2020-02-19T06:43:50.000Z", 
  "currency": "ZAR", 
  "customer_first_name": "John", 
  "customer_id": "", 
  "customer_last_name": "Preston", 
  "customer_salutation": "Mr", 
  "email": "example@example.com", 
  "expiry_date": "", 
  "fixed_amount": true, 
  "invoice_url": "https://upload.wikimedia.org/wikipedia/commons/a/a8/CCU_Logo.jpeg", 
  "long_url": "https://long-url", 
  "merchant_phone_number": null, 
  "mobile_number": "+12345678901", 
  "modified_at": "", 
  "payment_methods": [
    "GOOGLE_PAY",
    "AMEX"
  ], 
  "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_frequency": "ONE-TIME"
}
{
     "message": "Forbidden"
}
{
    "is_valid": false,
    "error_field": "",
    "error_message": "Apple Pay is not enabled. Please check your cofiguration and/or contact your administrator.",
    "result": "failed"
}

Request Samples
Loading...
Edit a Payment Request

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

Required Header:

  • Authorization
Request URL  
https://test.mobipaid.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://mobipaid.com",
    "response_url" : "https://mobipaid.com",
    "cancel_url" : "https://mobipaid.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false, 
    "shipping_enabled": false, 
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true, 
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": ["APPLE_PAY", "GOOGLE_PAY", "NEDBANK_EFT", "AMEX"],
    "expiry_date": ""
}

Examples
curl -X PUT https://test.mobipaid.io/v2/payment-requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_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://mobipaid.com",
    "response_url" : "https://mobipaid.com",
    "cancel_url" : "https://mobipaid.com",
    "fixed_amount": true,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": false,
    "shipping_enabled": false,
    "send_mms_invoice": true,
    "attach_invoice": true,
    "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": true,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
        "AMEX"
    ],
    "expiry_date": ""
}'
import requests
import json

url = "https://test.mobipaid.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://mobipaid.com",
    "response_url" : "https://mobipaid.com",
    "cancel_url" : "https://mobipaid.com",
    "fixed_amount": True,
    "currency": "ZAR",
    "amount": 1500.12,
    "tax_id": "",
    "template_id": "",
    "moto_enabled": False,
    "shipping_enabled": False,
    "send_mms_invoice": True,
    "attach_invoice": True,
    "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    "attach_receipt": True,
    "receipt_file_type": "pdf",
    "payment_type": "DB",
    "payment_methods": [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
       "AMEX"
    ],
    "expiry_date": ""
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payment-requests',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer mp_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://mobipaid.com",
        "response_url" : "https://mobipaid.com",
        "cancel_url" : "https://mobipaid.com",
        "fixed_amount": true,
        "currency": "ZAR",
        "amount": 1500.12,
        "tax_id": "",
        "template_id": "",
        "moto_enabled": false,
        "shipping_enabled": false,
        "send_mms_invoice": true,
        "attach_invoice": true,
        "invoice_url": "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
        "attach_receipt": true,
        "receipt_file_type": "pdf",
        "payment_type": "DB",
        "payment_methods": [
            "APPLE_PAY",
            "GOOGLE_PAY",
            "NEDBANK_EFT",
            "AMEX"
        ],
        "expiry_date": ""
    })

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

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

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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://mobipaid.com",
    response_url: "https://mobipaid.com",
    cancel_url: "https://mobipaid.com",
    fixed_amount: true,
    currency: "ZAR",
    amount: 1500.12,
    tax_id: "",
    template_id: "",
    moto_enabled: false,
    shipping_enabled: false,
    send_mms_invoice: true,
    attach_invoice: true,
    invoice_url: "https://mp-fixed-assets.s3.amazonaws.com/logo.png",
    attach_receipt: true,
    receipt_file_type: "pdf",
    payment_type: "DB",
    payment_methods: [
        "APPLE_PAY",
        "GOOGLE_PAY",
        "NEDBANK_EFT",
        "AMEX"
    ],
    expiry_date: ""
}.to_json

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

Result Format
{
    "result": "success",
    "transaction_id": "145497OO",
    "request_methods": [
        "WEB"
    ],
    "reference_number": "123",
    "email": "example@example.com",
    "mobile_number": "+12345678901",
    "merchant_phone_number": null,
    "customer_id": "",
    "customer_salutation": "Mr",
    "customer_first_name": "John",
    "customer_last_name": "Preston",
    "payment_type": "DB",
    "currency": "ZAR",
    "amount": "1500.12",
    "fixed_amount": true,
    "short_url": "https://shorturl",
    "long_url": "https://longurl",
    "qrcode_link": "https://qrlink",
    "tax_id": "",
    "template_id": "",
    "payment_methods": [
        "GOOGLE_PAY",
       "AMEX"
    ],
    "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 is not valid"
}
{
     "message": "Forbidden"
}

Request Samples
Loading...
Get a Payment Request detail

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

Required Header:

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

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

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payment-requests?page=5&limit=1',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer mp_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.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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": ["AMEX"], 
      "payment_type": "DB", 
      "receipt_file_type": null, 
      "reference_number": "44923", 
      "refund": [], 
      "request_methods": [
        "SMS", 
        "EMAIL"
      ], 
      "reversal": [], 
      "send_mms_receipt": false, 
      "shipping_information": false, 
      "status": "success", 
      "status_description": "", 
      "tax_id": "PKZMknlE", 
      "transaction_id": "145429OO", 
      "url": "https://s.mpaid.us/37cfJ"
    }
  ]
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Delete a Payment Request

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

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

Required Header:

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

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

payload  = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payment-requests/2116376OO',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer mp_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.mobipaid.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 mp_live_9Au2ABAwToHDfMf1kiwr"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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 is not found.",
    "result": "failed"
}

Request Samples
Loading...
Payment Response

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

response {
    "result": "ACK",
    "token": "9b6352ab516a043cd33cf65cf8210af35bd4d3c9",
    "transaction_id": "211PO",
    "payment_id": "8ac7a4a074726760017472b283ce070f",
    "amount": "50.33",
    "currency": "USD",
    "currency_symbol": "$",
    "result_code": "000.100.110",
    "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'",
    "additional_info_text": {
        "Type": "baju baru"
    },
    "additional_info_dropdown": {
        "Size": "M"
    },
    "cart_items": "[{\"sku\":\"123\",\"name\":\"Blue Shirt XL\",\"qty\":1,\"unit_price\":11.2},{\"sku\":\"456\",\"name\":\"Black Short Pant XL\",\"qty\":2,\"unit_price\":22.4}]"
}
Payment History

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

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

Get Payment History

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

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

Query Description
start_date

string

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

end_date

required with condition

string

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

page

number

Select the payment history

limit

number

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

keywords

string

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

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

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

payload = {}
headers = {
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payments?limit=5&page=1',
  'headers': {
    'Authorization': 'Bearer mp_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.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
request["Content-Type"] = "application/json"

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

Result Format
{
    "payments": [
        {
            "payment_id": "8ac7a4a2735bed2301736a2e1cd40318",
            "reference_payment_id": null,
            "transaction_id": "1130OO",
            "transaction_type": "once-off",
            "reference_number": "123",
            "mobile_number": "+12345678901",
            "email": "email@domain.com",
            "amount": 1500.12,
            "currency": "ZAR",
            "payment_type": "CC.PA",
            "payment_date": "2020-07-20T03:04:33.000Z",
            "status": "success",
            "result_description": "Request successfully processed in 'Merchant in Integrator Test Mode'",
            "payment_url": "https://s.mpaid.us/sMBaf",
            "transaction_date": "2020-07-20T03:03:54.000Z",
            "request_detail": {
                "tip_amount": 0,
                "tax_percentage": "0.00 %",
                "tax_amount": 0,
                "additional_info": {},
                "additional_info_text": {},
                "additional_info_dropdown": {},
                "cart_items": {}
            }
        },
        {
            "payment_id": "8ac7a4a1730e6e3e017313846dd54eeb",
            "reference_payment_id": null,
            "transaction_id": "11PO",
            "transaction_type": "pos_payment",
            "reference_number": "MP1",
            "mobile_number": null,
            "email": null,
            "amount": 50.33,
            "currency": "EUR",
            "payment_type": "CC.DB",
            "payment_date": "2020-07-03T07:11:52.000Z",
            "status": "failed",
            "result_description": "Invalid payment data. You are not configured for this currency or sub type (country or brand)",
            "payment_url": "https://sandbox-pay.mobipaid.com/pos_link/GpWv30S-OqDAtU3tOjO6NQ",
            "transaction_date": "2020-04-03T06:21:44.000Z",
            "request_detail": {
                "tip_amount": 0,
                "tax_percentage": "0.00 %",
                "tax_amount": 0,
                "additional_info": {},
                "additional_info_text": {
                    "text": "asd"
                },
                "additional_info_dropdown": {
                    "size": "S"
                },
                "cart_items": [
                    {
                        "sku": "-",
                        "name": "Blue Shirt XL",
                        "qty": 3,
                        "unit_price": 2
                    },
                    {
                        "sku": "456",
                        "name": "Black Short Pant XL",
                        "qty": 2,
                        "unit_price": 22.4
                    }
                ]
            }
        }
    ],
    "page": 1,
    "limit": 2,
    "start_date": "2020-07-01",
    "end_date": "2020-08-30",
    "page_count": 3,
    "total_count": 5
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Get Payment History detail

Fetch a single payment history from Mobipaid

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.mobipaid.io/v2/payments/{payment_id}
Examples
curl -X GET https://test.mobipaid.io/v2/payments/{payment_id} \
--header "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
import requests

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

payload = {}
headers = {
  'Content-Type': ' application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/payments/8ac7a4a26ff5c0c4016ff617ed2128fa99999999',
  'headers': {
    'Content-Type': ' application/json',
    'Authorization': 'Bearer mp_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.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"

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

Result Format
{
    "payment": {
        "payment_id": "8ac7a4a1730e6e3e017313846dd54eeb",
        "reference_payment_id": null,
        "transaction_id": "11PO",
        "transaction_type": "pos_payment",
        "reference_number": "MP1",
        "mobile_number": null,
        "email": null,
        "amount": 50.33,
        "currency": "EUR",
        "payment_type": "CC.DB",
        "payment_date": "2020-07-03T07:11:52.000Z",
        "status": "failed",
        "result_description": "Invalid payment data. You are not configured for this currency or sub type (country or brand)",
        "payment_url": "https://sandbox-pay.mobipaid.com/pos_link/GpWv30S-OqDAtU3tOjO6NQ",
        "transaction_date": "2020-04-03T06:21:44.000Z",
        "request_detail": {
            "tip_amount": 0,
            "tax_percentage": "0.00 %",
            "tax_amount": 0,
            "additional_info": {},
            "additional_info_text": {
                "text": "asd"
            },
            "additional_info_dropdown": {
                "size": "S"
            },
            "cart_items": [
                {
                    "sku": "-",
                    "name": "Blue Shirt XL",
                    "qty": 3,
                    "unit_price": 2
                },
                {
                    "sku": "456",
                    "name": "Black Short Pant XL",
                    "qty": 2,
                    "unit_price": 22.4
                }
            ]
        }
    }
}
{
"message": "Your Payment history data is not found",
"result": "failed"
}
{
    "message": "Forbidden"
}

Request Samples
Loading...
Refund

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

Body Params
Field Description
amount

required

number

The amount to be refunded to the customer

email

string

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

mobile_number

string

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

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

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

url = "https://test.mobipaid.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 mp_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.mobipaid.io/v2/refunds',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer mp_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.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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 is not found."
}
{
    "is_valid": false,
    "error_field": "amount",
    "error_message": "amount is required.",
    "result": "failed"
}

Request Samples
Loading...
Capture

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

Body Params
Field Description
amount

required

number

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

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

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

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

payload = json.dumps( {
    "amount": 10
} )
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/captures/8ac7a49f7297dc2701729954fc4c1f71',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer mp_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.mobipaid.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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://test.mobipaid.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 mp_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 is not found."
}

Request Samples
Loading...
Cancel a subscription

Cancel a subscription that is already paid in the payment history with type scheduled. You have to include the payment_id of the scheduled payment in the payment history in order to cancel it.

Request URL  
https://live.mobipaid.io/v2/payments/subscription/{payment_id}
Examples
curl -X DELETE https://live.mobipaid.io/v2/payments/subscription/{payment_id} \
--header "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
import requests
import json

url = "https://live.mobipaid.io/v2/payments/subscription/8ac7a49f7297dc2701729954fc4c1f71"

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

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

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

var options = {
    method: "DELETE",
    url: "https://live.mobipaid.io/v2/payments/subscription/8ac7a4a07532805d017540b10b420dbd",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer mp_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://live.mobipaid.io/v2/payments/subscription/8ac7a4a07532805d017540b10b420dbd",
  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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://live.mobipaid.io/v2/payments/subscription/8ac7a4a07532805d017540b10b420dbd")

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 mp_test_w3Lwv3CZIZzye4cYxxr0"

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

Result Format
{
    "transaction_type": "scheduled",
    "payment_id": "8ac7a4a2753280600175404c232c4189",
    "email": "whibi9999@gmail.com",
    "mobile_number": "+6282115888911",
    "amount": 56,
    "currency": "ZAR",
    "ref_number": "ref001",
    "status": "subscription_ended"
}
{
    "result": "failed",
    "message": "Payment is not found."
}

Request Samples
Loading...
Message Templates

Create new message template for SMS and Email with this feature.

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

You can create message template based on transaction type.

Create a Message Template

Create a new message template for the merchant.

Body Params
Field Description
template_name

 

string

Message template name. Example : "Once-off payment request template".

transaction_type

 

string

The transaction type which message template belongs to. Can only be filled with "once-off" or "scheduled".

email_subject

 

string

The subject of message template. For example : "Payment due to Mad Decent".

email_content

 

string

The content of email message template.

sms_content

 

string

The content of SMS message template.

default

 

boolean

Use "true" if you want to set this message template as default once-off/scheduled message template for this merchant.

global_template

 

boolean

Use "true" if you want to set this message template available for other user under this merchant. Use "false" if you want message template can only be used by the owner.

Request URL  
https://live.mobipaid.io/v2/message-templates
Request Body
{
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }

Examples
curl -X POST https://live.mobipaid.io/v2/message-templates \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0" \
--data '{
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }'
import requests
import json

url = "https://live.mobipaid.io/v2/message-templates"

payload = json.dumps( {
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer mp_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://live.mobipaid.io/v2/message-templates",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
    },
    body: JSON.stringify({
        "template_name": "Test Once Off Template",
	    "transaction_type": "once-off",
	    "email_subject": "Test Once Off",
	    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init();

$data = array(
    "template_name" => "Test Once Off Template",
    "transaction_type" => "once-off",
    "email_subject" => "Test Once Off",
    "email_content" => "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content" => "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default" => true, "global_template" => true ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://live.mobipaid.io/v2/message-templates", 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 mp_test_w3Lwv3CZIZzye4cYxxr0" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri"
require "net/http"
require "json"

url = URI("https://live.mobipaid.io/v2/message-templates")

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 mp_test_w3Lwv3CZIZzye4cYxxr0"
request.body = {
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }.to_json response = https.request(request) puts response.read_body

Result Format
{
    "result": "success",
    "template_id": "j4nJ74Xa",
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }
{
    "is_valid": false,
    "error_field": "transaction_type",
    "error_message": "Disallowed transaction_type found. Please check the documentation again."
}

Request Samples
Loading...
Edit a Message Template

You can update the message template by using the same parameters from create a message template, but you have to add template_id to the body.

Required Header:

  • Authorization
Request URL  
https://live.mobipaid.io/v2/message-templates
Request Body
{
    "template_id": "j4nJ74Xa",
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }

Examples
curl -X PUT https://live.mobipaid.io/v2/message-templates \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0" \
--data '{
    "template_id": "j4nJ74Xa",
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }'
import requests
import json

url = "https://live.mobipaid.io/v2/message-templates"

payload = json.dumps( {
    "template_id": "j4nJ74Xa",
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true } ) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer mp_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://live.mobipaid.io/v2/message-templates",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
    },
    body: JSON.stringify({
        "template_id": "j4nJ74Xa",
		"template_name": "Test Once Off Template",
		"transaction_type": "once-off",
		"email_subject": "Test Once Off",
		"email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }) }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
$curl = curl_init();

$data = array(
    "template_id" => "j4nJ74Xa",
	"template_name" => "Test Once Off Template",
	"transaction_type" => "once-off",
	"email_subject" => "Test Once Off",
	"email_content" => "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content" => "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default" => true, "global_template" => true ); $data = json_encode($data); curl_setopt_array($curl, array( CURLOPT_URL => "https://live.mobipaid.io/v2/message-templates", 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 mp_test_w3Lwv3CZIZzye4cYxxr0" ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
require "uri"
require "net/http"
require "json"

url = URI("https://live.mobipaid.io/v2/message-templates")

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 mp_test_w3Lwv3CZIZzye4cYxxr0"
request.body = {
    "template_id": "j4nJ74Xa",
	"template_name": "Test Once Off Template",
	"transaction_type": "once-off",
	"email_subject": "Test Once Off",
	"email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }.to_json response = https.request(request) puts response.read_body

Result Format
{
    "result": "success",
    "template_id": "j4nJ74Xa",
    "template_name": "Test Once Off Template",
    "transaction_type": "once-off",
    "email_subject": "Test Once Off",
    "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true }
{
    "is_valid": false,
    "error_field": "transaction_type",
    "error_message": "Disallowed transaction_type found. Please check the documentation again."
}

Request Samples
Loading...
Get a Message Template detail

You can fetch a message template detail by using GET method with a template_id in the route parameter

Required Header:

  • Authorization
Request URL  
https://live.mobipaid.io/v2/message-templates/{template_id}
Examples
curl -X GET https://test.mobipaid.io/v2/message-templates/{template_id} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
import requests
import json

url = "https://live.mobipaid.io/v2/message-templates?page=5&limit=1"

payload = {}
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer mp_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.mobipaid.io/v2/message-templates?page=5&limit=1",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer mp_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://live.mobipaid.io/v2/message-templates?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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://live.mobipaid.io/v2/message-templates?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 mp_test_w3Lwv3CZIZzye4cYxxr0"

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

Result Format
{
    "result": "success",
    "limit": 10,
    "page": 1,
    "page_count": 1,
    "total_count": 1,
    "templates": [
        {
            "template_id": "j4nJ74Xa",
            "template_name": "Test Once Off Template",
            "transaction_type": "once-off",
            "email_subject": "Test Once Off",
            "email_content": "Hi, #email#
We want to inform that you have new payment request with the amount of #currency# #amount#.
Click #url# for auto redirected to payment page.", "sms_content": "Hi, we want to inform that you have new payment request with the amount of #currency# #amount#. Click #url# for auto redirected to payment page", "default": true, "global_template": true } ] }
{
    "is_valid": false,
    "error_field": "template_id",
    "error_message": "template_id is not valid"
}

Request Samples
Loading...
Delete a Message Template

You can delete a message template by using the DELETE method with a template_id in the route parameter.

Required Header:

  • Authorization
Request URL  
https://live.mobipaid.io/v2/message-templates/{template_id}
Examples
curl -X DELETE https://test.mobipaid.io/v2/message-templates/{template_id} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mp_test_w3Lwv3CZIZzye4cYxxr0"
import requests
import json

url = "https://live.mobipaid.io/v2/message-templates/j4nJ74Xa"

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

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

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

var options = {
    method: "DELETE",
    url: "https://live.mobipaid.io/v2/message-templates/j4nJ74Xa",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer mp_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://live.mobipaid.io/v2/message-templates/j4nJ74Xa",
  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 mp_test_w3Lwv3CZIZzye4cYxxr0"
  ),
));

$response = curl_exec($curl);

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

url = URI("https://live.mobipaid.io/v2/message-templates/j4nJ74Xa")

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 mp_test_w3Lwv3CZIZzye4cYxxr0"

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

Result Format
{
    "result": "success",
    "template_id": "j4nJ74Xa"
}
{
    "is_valid": false,
    "error_field": "template_id",
    "error_message": "template_id is not valid"
}

Request Samples
Loading...