Refund Sale

Credentials

Overview

Refund request enable you to reimburse a charge that was previously generated but remains unreimbursed. The funds will be returned to the initial payment method used for the charge.

Callback

Once the sale is refunded successfully, we will update the marketplace with the sale details with a POST request of type x-www-form-urlencoded to the marketplace Callback URL.

Note:

You can refund multiple times per sale as long as you do not exceed the total amount of the sale. If you do not send the `sale_refund_amount' parameter, the sale will be fully refunded.

Parameters

This endpoint takes no path, query or header parameters.

Request body

Content type: application/json

Field Type Required Description
payme_client_key string yes PayMe Partner Key.
seller_payme_id string yes MPL. Your private key in PayMe system.
payme_sale_id string yes Our unique sale ID.
sale_refund_amount integer no Used only for partial refunds, for a full refund exclude this attribute. For example: if the amount is 50.75 (max 2 decimal points) the value that recieved is 5075. Note that the minimum value is 500.
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 Status of the request (success, error)
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
payme_transaction_acquirer string Transaction acquirer
{
  "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
}