Void Sale

This is a variant of POST /refund-sale — Refund Sale; the request and responses below are the ones documented for Post Sale Actions.

Credentials

Overview

In order to initiatea void for an authorization, you will be able to do so using the same API call for a refund.

In order to be eligible for a void, the request must be initiated for:

  1. Sale type must be authorization
  2. The amount required to be voided must be the equal to amount requested and authorized initially.

Sale Types

You can find all the sale statuses here.

Parameters

This endpoint takes no path, query or header parameters.

Request body

Content type: application/json

Field Type Required Description
seller_payme_id string yes MPL. Your private key in PayMe system.
payme_sale_id string yes Our unique sale ID.
sale_currency string no Sale currency.
language string no Changes the error message language to English.

Request example

{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/refund-sale' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/refund-sale", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "payme_client_key": "XXXXXXXX",
    "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "sale_refund_amount": 1000,
    "language": "he"
  }),
});

console.log(await response.text());

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/refund-sale",
    json={
        "payme_client_key": "XXXXXXXX",
        "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
        "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
        "sale_refund_amount": 1000,
        "language": "he",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "payme_client_key": "XXXXXXXX",
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALEDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "sale_refund_amount": 1000,
  "language": "he"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/refund-sale');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

Responses

200 — OK (success)

Field Type Description
status_code integer Status of the request (0 - success, 1 - error).
status_error_code integer Our unique error code.
payme_status string
refunded_from_creditcard boolean Return true if seller has not enough money for refund and we complete the refund from the seller credit card.
sale_invoice_number integer Sale invoice Number.
sale_invoice_url string Sale invoice URL, if the seller has enabled the invoices module in his account panel.
sale_refund_buffer integer The refund buffer of this sale.
sale_status string Refund status.
payme_transaction_total integer The refund amount that the buyer will get.
payme_transaction_total_aft_deduction integer The amount that the seller will be charge on.
payme_transaction_id string The transaction unique id.
payme_transaction_card_brand string Card brand.
payme_transaction_auth_number string Authorization number from credit company.
payme_transaction_voucher string Transaction voucher
payme_signature string MD5 Signature
{
  "status_code": 0,
  "status_error_code": 0,
  "payme_status": "success",
  "refunded_from_creditcard": false,
  "sale_invoice_number": null,
  "sale_invoice_url": null,
  "sale_refund_buffer": 18800,
  "sale_status": "partial-refund",
  "payme_transaction_total": 1000,
  "payme_transaction_total_aft_deduction": 1000,
  "payme_transaction_id": "TRANDEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_transaction_card_brand": "XXXXXXXX",
  "payme_transaction_auth_number": "72****4",
  "payme_transaction_voucher": "24****9",
  "payme_signature": "b71e**************ca5a",
  "payme_transaction_arn": null
}