Generate Sale with Apple Pay

This is a variant of POST /generate-sale — Generate Payment; the request and responses below are the ones documented for Apple Pay.

Credentials

Overview

In order to initiate the process of paying using Apple Pay APM, you will first need to initiate a generate-sale request to our API.

The request shall include "apple-pay" as the sale_payment_method.

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 Our unique seller ID (MPL).
sale_price string yes The sale price.
currency string yes The sale currency (ISO 4217 Code).
product_name string yes What is the payment for.
language string no The language of the user interface.
sale_payment_method string yes The payment method used for the transaction.
sale_type string yes The required sale type.

Request example

{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_payment_method": "apple-pay",
  "sale_type": "sale"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/generate-sale' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_payment_method": "apple-pay",
  "sale_type": "sale"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/generate-sale", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
    "sale_price": "1000",
    "currency": "ILS",
    "product_name": "Shirt",
    "language": "en",
    "sale_payment_method": "apple-pay",
    "sale_type": "sale"
  }),
});

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

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/generate-sale",
    json={
        "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
        "sale_price": "1000",
        "currency": "ILS",
        "product_name": "Shirt",
        "language": "en",
        "sale_payment_method": "apple-pay",
        "sale_type": "sale",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_payment_method": "apple-pay",
  "sale_type": "sale"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/generate-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 number 0 - Success 1 - Failure
sale_url string The URL to complete the payment.
payme_sale_id string Our unique sale ID
payme_sale_code number Our unique sale code (for display purposes only)
price number Sale final price. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075
transaction_id string Merchant's unique sale ID for correlation with us
currency string The currency of the payment.
sale_payment_method string The payment method used to generate the new payment.
{
  "status_code": 0,
  "sale_url": "https://preprod.paymeservice.com/sale/generate/Sale_guid",
  "payme_sale_id": "SALEguid",
  "payme_sale_code": 1032526,
  "price": 1000,
  "transaction_id": "",
  "currency": "ILS",
  "sale_payment_method": "apple-pay"
}

500 — Internal Server Error (error)