POST https://sandbox.payme.io/api/generate-subscriptionPOST https://live.payme.io/api/generate-subscriptionpayme_client_key (required): PayMe Partner Key.seller_payme_id (required): MPL. Your private key in PayMe system.This endpoint is used to generate new subscriptions. You can find more information in our guide - How to create a subscription .
This endpoint takes no path, query or header parameters.
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. |
sub_currency |
string | yes | Subscription currency. 3-letter ISO 4217 name. |
sub_price |
string | yes | A single iteration final price. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075. Note that the minimum value is 500 |
sub_description |
string | yes | The description of the service/product |
sub_iteration_type |
string | yes | 1 - Daily, 2 - Weekly, 3 - Monthly, 4 - Yearly |
language |
string | no | Changes the language of the payment IFRAME to English, as well as the error messages. Default value is Hebrew (he) |
sub_start_date |
string | no | Subscription initiation date. For iteration type = 3 (monthly) the day value should be between 1 to 28 |
sub_payment_method |
string | no | Sale Payment Method (for the list see Payment Methods) |
sub_type |
number | no | subscription type: 1-regular, 10-template |
buyer_key |
string | no | Buyer key for subscription payment with the token. Relevant only for sub_type = regular. This key is received through the use of capture_buyer. Note that with this attribute no need to activate pay-subscription. |
subscription_id |
string | no | Merchant's unique subscription ID for correlation with us |
sub_iterations |
number | no | The iterations count set for the subscription. Default value is set to unlimited by -1 value. |
sub_callback_url |
string | no | Callback response to your page regarding updates on subscription events. |
sub_return_url |
string | no | Once the subscription was paid successfully, the user will be redirected to this URL Relevant to the first subscription iteration, if it is paid through our iframe. |
sub_indicative_name |
string | no | Indicative name for the subscribition |
sub_email_address |
string | no | Email address of the subscription payer |
sub_indicative_mobile |
string | no | Phone number to send receipt |
sub_send_notification |
boolean | no | Indication if to send notifications on subscription events. |
{
"seller_payme_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
"sub_price": 500,
"sub_currency": "USD",
"sub_description": "Subscription for something",
"sub_iteration_type": "3",
"sub_iterations": 12,
"sub_start_date": "1440354488",
"sub_callback_url": "https://www.example.com/payment/callback",
"sub_return_url": "https://www.example.com/payment/success",
"buyer_key": "XXXXXXXX",
"language": "en"
}
curl -X POST 'https://sandbox.payme.io/api/generate-subscription' \
-H 'Content-Type: application/json' \
--data-raw '{
"seller_payme_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
"sub_price": 500,
"sub_currency": "USD",
"sub_description": "Subscription for something",
"sub_iteration_type": "3",
"sub_iterations": 12,
"sub_start_date": "1440354488",
"sub_callback_url": "https://www.example.com/payment/callback",
"sub_return_url": "https://www.example.com/payment/success",
"buyer_key": "XXXXXXXX",
"language": "en"
}'
const response = await fetch("https://sandbox.payme.io/api/generate-subscription", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"seller_payme_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
"sub_price": 500,
"sub_currency": "USD",
"sub_description": "Subscription for something",
"sub_iteration_type": "3",
"sub_iterations": 12,
"sub_start_date": "1440354488",
"sub_callback_url": "https://www.example.com/payment/callback",
"sub_return_url": "https://www.example.com/payment/success",
"buyer_key": "XXXXXXXX",
"language": "en"
}),
});
console.log(await response.text());
import requests
response = requests.post(
"https://sandbox.payme.io/api/generate-subscription",
json={
"seller_payme_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
"sub_price": 500,
"sub_currency": "USD",
"sub_description": "Subscription for something",
"sub_iteration_type": "3",
"sub_iterations": 12,
"sub_start_date": "1440354488",
"sub_callback_url": "https://www.example.com/payment/callback",
"sub_return_url": "https://www.example.com/payment/success",
"buyer_key": "XXXXXXXX",
"language": "en",
},
)
print(response.text)
<?php
$body = <<<'BODY'
{
"seller_payme_id": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
"sub_price": 500,
"sub_currency": "USD",
"sub_description": "Subscription for something",
"sub_iteration_type": "3",
"sub_iterations": 12,
"sub_start_date": "1440354488",
"sub_callback_url": "https://www.example.com/payment/callback",
"sub_return_url": "https://www.example.com/payment/success",
"buyer_key": "XXXXXXXX",
"language": "en"
}
BODY;
$ch = curl_init('https://sandbox.payme.io/api/generate-subscription');
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;
| Field | Type | Description |
|---|---|---|
sub_url |
string | Subscription Unique URL |
status_code |
string | Status code (0 - sucess, 1 - failed) |
payme_status |
string | PayMe updated status` |
seller_payme_id |
string | |
seller_id |
string | Our unique seller ID |
sub_payme_id |
string | PayMe's unique subscription ID |
sub_payme_code |
string | PayMe's subscription code |
subscription_id |
string | Subscription unique ID |
sub_created |
string | The date the subscription was created |
sub_start_date |
string | Subscription initiation date |
sub_prev_date |
string | Previous subscription payment date |
sub_next_date |
string | Subscription next payment due date |
sub_status |
string | Subscription status (0 - active, 1 - inactive) |
sub_iteration_type |
string | 1 - Daily, 2 - Weekly, 3 - Monthly, 4 - Yearly |
sub_currency |
string | Subscription currency. 3-letter ISO 4217 name. |
sub_price |
string | A single iteration final price. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075. Note that the minimum value is 500 |
sub_description |
string | Subscription description - What is the subscription for? |
sub_iterations |
string | The iterations count set for the subscription according to the request command |
sub_iterations_completed |
number | The number of iterations completed for the specific subscription |
sub_iterations_left |
string | Count of iteration left for the specific subscription |
sub_paid |
boolean | Was the subscription fully paid or not |
status_error_code |
number | Error code in case of an error |
sub_error_text |
string | Error description in case of an error |
{
"sub_url": "string",
"status_code": "0",
"payme_status": "string",
"status_error_code": "string",
"seller_payme_id": "string",
"seller_id": "string",
"sub_payme_id": "string",
"sub_payme_code": "string",
"subscription_id": "string",
"sub_created": "string",
"sub_start_date": "string",
"sub_prev_date": "string",
"sub_status": "string",
"sub_next_date": "string",
"sub_iteration_type": "string",
"sub_currency": "string",
"sub_price": "string",
"sub_description": "string",
"sub_iterations": "string",
"sub_iterations_completed": 0,
"sub_iterations_left": "string",
"sub_paid": true,
"sub_error_text": "string"
}
| Field | Type | Description |
|---|---|---|
status_code |
number | Status code 1 (for failure) |
status_error_details |
string | What caused the error |
status_additional_info |
string | The parameters related to the error |
status_error_code |
number | Status error code - 1 |
{
"status_code": 1,
"status_error_details": "Required parameter is missing",
"status_additional_info": "seller_payme_id",
"status_error_code": 1
}