Assign Payer

POST /v1/payments/payment/{payment_id}/assign

To assign a payer to payment transaction

Parameter

payment_id String Mandatory

Unique Identifier of payment transaction

Request Body

payer String Mandatory

Unique reference id of payer to be assigned for the payment transaction

Response

code Number

Please refer to Response Code

description String

Description of response

Sample Code


curl -X POST  https://sandbox.api.liquidpay.com/openapi/v1/payments/payment/{{payment_id}}/assign \
  -H 'content-type: application/json' \
  -H 'Liquid-Api-Key: {{api_key}}' \
  -d '{
    "payer": "{{payer}}"
}'

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

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

$request->setBody('{
  "payer": "{{payer}}",
}');

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/{{payment_id}}/assign");
var request = new RestRequest(Method.POST);
request.AddHeader("Liquid-Api-Key", "{{api_key}}");
request.AddParameter("application/json", "{\n\t\"payer\": \"{{payer}}\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

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

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

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

#import 

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

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

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://sandbox.api.liquidpay.com/openapi/v1/payments/payment/{{payment_id}}/assign"]
                                                       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 = [
  "payer": "{{payer}}"
] 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/{{payment_id}}/assign")! 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) -> assign in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()