Generate Sale with Google Pay

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

Credentials

Overview

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

The request shall include "google-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. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075
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. You can use also multi to allow buyer to select his preffered payment method.
sale_type string yes The required sale type.

Request example

No example is documented; this template is generated from the fields — replace the placeholder values.

{
  "seller_payme_id": "<seller_payme_id>",
  "sale_price": "<sale_price>",
  "currency": "<currency>",
  "product_name": "<product_name>",
  "language": "<language>",
  "sale_payment_method": "<sale_payment_method>",
  "sale_type": "<sale_type>"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/generate-sale' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "<seller_payme_id>",
  "sale_price": "<sale_price>",
  "currency": "<currency>",
  "product_name": "<product_name>",
  "sale_payment_method": "<sale_payment_method>",
  "sale_type": "<sale_type>"
}'

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": "<seller_payme_id>",
    "sale_price": "<sale_price>",
    "currency": "<currency>",
    "product_name": "<product_name>",
    "sale_payment_method": "<sale_payment_method>",
    "sale_type": "<sale_type>"
  }),
});

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

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/generate-sale",
    json={
        "seller_payme_id": "<seller_payme_id>",
        "sale_price": "<sale_price>",
        "currency": "<currency>",
        "product_name": "<product_name>",
        "sale_payment_method": "<sale_payment_method>",
        "sale_type": "<sale_type>",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "seller_payme_id": "<seller_payme_id>",
  "sale_price": "<sale_price>",
  "currency": "<currency>",
  "product_name": "<product_name>",
  "sale_payment_method": "<sale_payment_method>",
  "sale_type": "<sale_type>"
}
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.
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.

500 — Internal Server Error (error)

Field Type Description
status_code number Status code - will always be 1 for failed requests.
status_error_details string Reasons for the failed request.
status_additional_info string
status_error_code number Error code for further support.