Create Payment

POST /v1/payments/payment

To create a payment request which will in turn generate a QR code for payment.

 

Request Body

payee String Mandatory

Merchant who is receiving the payment, payee id can be obtained during enrollment

Sample payee
product_type String Mandatory

Please refer to Product Type

merchant_ref_no String Mandatory

Merchant unique reference number

currency_code 3 letter currency code

By default, will be presented in home currency (the one associated with merchant account)

amount Number with 2 decimal Mandatory

Transaction Amount

payer String

Consumer who is paying the payment

metadata Object

Please refer to Metadata

sign_type String Conditional

Please refer to Signature Mechanism

sign String Conditional

Please refer to Signature Mechanism

Response Body

code Number

Please refer to Response Code

description String

Description of response

payment_id String

Unique Identifier of payment transaction

payment_code String

Payment code which is returned in the QR

payment_token String

Unique associated token representing the payment transaction

qr_data Object

Please refer to QR Data

metadata Object

Please refer to metadata

Sample Code


curl -X POST  https://sandbox.api.liquidpay.com/openapi/v1/payments/payment \
  -H 'content-type: application/json' \
  -H 'Liquid-Api-Key: {{api_key}}' \
  -d '{
  "payee": "{{payee}",
  "product_type": "{{product_type}}",
  "merchant_ref_no": "{{merchant_ref_no}}",
  "amount": {{amount}}
}'

$request = new HttpRequest();
$request->setUrl('https://sandbox.api.liquidpay.com/openapi/v1/payments/payment');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'content-type' => 'application/json',
  'Liquid-Api-Key' => '{{api_key}}'
));

$request->setBody('{
  "payee": "{{payee}}",
  "product_type": "{{product_type}}",
  "merchant_ref_no": "{{merchant_ref_no}}",
  "amount": {{amount}},
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

var client = new RestClient("https://sandbox.api.liquidpay.com/openapi/v1/payments/payment");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Liquid-Api-Key", "{{api_key}}");
request.AddParameter("application/json", "{\"payee\":\"{{payee}}\",\"product_type\":\"{{product_type}}\",\"merchant_ref_no\":\"{{merchant_ref_no}}\",\"amount\":{{amount}}, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://sandbox.api.liquidpay.com/openapi/v1/payments/payment",
  "method": "POST",
  "headers": {
    "Liquid-Api-Key": "{{api_key}}",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{\"payee\":\"{{payee}}\",\"product_type\":\"{{product_type}}\",\"merchant_ref_no\":\"{{merchant_ref_no}}\",\"amount\":{{amount}} }"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

HttpResponse response = Unirest.post("https://sandbox.api.liquidpay.com/v1/payments/payment")
  .header("Liquid-Api-Key", "{{api_key}}")
  .header("content-type", "application/json")
  .body("{\"\"payee\":\"{{payee}}\", \"product_type\":\"{{product_type}}\",\"merchant_ref_no\":\"{{merchant_ref_no}}\",\"amount\":{{amount}}}");
  .asString();

#import 

NSDictionary *headers = @{ @"Liquid-Api-Key": @"{{api_key}}",
                           @"content-type": @"application/json";
NSDictionary *parameters = @{ @"payee": @"{{payee}}",
                              @"product_type": @"{{product_type}}",
                              @"merchant_ref_no": @"{{merchant_ref_no}}",
                              @"amount": @{{amount}};

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.api.liquidpay.com/openapi/v1/payments/payment"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];

import Foundation

let headers = [
  "Liquid-Api-Key": "{{api_key}}",
  "content-type": "application/json"
]
let parameters = [
  "payee": "{{payee}}",
  "product_type": "{{product_type}}",
  "merchant_ref_no": "{{merchant_ref_no}}",
  "amount": {{amount}},
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.api.liquidpay.com/openapi/v1/payments/payment")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()