Documentation
Cancellation API
API URL
https://api.paymentwall.com/developers/api/ticket
Request
Request method: POST
Request parameters:
Parameter | Required | Possible values | Description |
---|---|---|---|
key | yes | hexadecimal, 32 characters long | Project key, can be found in General Settings of the Project inside of your Merchant Account |
ref | yes* | alphanumeric | Transaction reference ID - ‘ref’ field from the pingback |
uid | yes* | alphanumeric, up to 64 characters long | User id |
type | yes | 1, 2 or 3 |
Ticket type. Possible values:
|
message | yes | String | Message or description of ticket from user / support team |
sign | yes | hexadecimal, 32 characters long, lowercase | Request signature. Refer to signature calculation section below. Important: required format is lowercase |
test_mode | no | 1 or 0 | Possible values: 1, 0. 1 means that the API is used in test mode, in this case no real uid or ref is required. |
* Either ref or uid is required
Response
Response data format: JSON
Response parameters:
Parameter | Description |
---|---|
result |
Result of request. Possible values: 1 - success |
errors | Array of error messages in case of error |
Possible errors:
Error | Action |
---|---|
You have no access to the developers API | Please make sure that
|
Either ref or uid is required | Make sure that you provide either uid or ref parameter or both |
Signature calculation and posting a ticket
Please note that project key and secret from example need to be replaced with your own.
<?php
function generateCancellationSignature($params, $secret) {
// work with sorted data
ksort($params);
// generate the base string
$baseString = '';
foreach($params as $key => $value) {
$baseString .= $key . '=' . $value;
}
$baseString .= $secret;
return strtolower(md5($baseString));
}
$secret = 'ac8af8eeb4d5d33d1986bcb52719027b';
$params = array(
'key' => 'f04150f73d04e47029548e526b2b12ec',
'ref' => 'b1563',
'uid' => '218069',
'type' => '1',
'message' => 'Please cancel asap',
'test_mode' => '0' // pass 1 to perform tests without an actual transaction
);
$params['sign'] = generateCancellationSignature($params, $secret);
$post = curl_init();
curl_setopt($post, CURLOPT_URL, 'https://api.paymentwall.com/developers/api/ticket');
curl_setopt($post, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($post, CURLOPT_POST, 1);
curl_setopt($post, CURLOPT_POSTFIELDS, $params);
curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($post, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($post);
Given example will generate the following signature: 9dc4316d3a3d6951d94d1edf6ce735f5
It will also post the ticket.