Sale
Charge a payment instrument in a single step.
curl --request POST \
--url https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id} \
--header 'Content-Type: application/json' \
--header 'x-signature: <api-key>' \
--header 'x-timestamp: <api-key>' \
--data '
{
"merchant_transaction_id": "<string>",
"amount": 500000,
"transaction_session": {
"request_ip_address": "<string>",
"browser_profile": {
"name": "<string>",
"version": "<string>",
"language": "<string>",
"user_agent": "<string>",
"java_enabled": true,
"is_webview": true
},
"screen_width": 32767,
"screen_height": 32767,
"screen_color_depth": 32767,
"accept_headers": "<string>",
"time_zone_offset": 0
},
"order_id": "<string>",
"order": {
"merchant_order_id": "<string>",
"payer_fingerprint": "<string>",
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 123,
"card_cardholder_name": "<string>",
"card_profile": {
"fingerprint": "<string>"
},
"cvv": "<string>"
},
"description": "<string>"
},
"delivery_address_usage_indicator": "<string>",
"delivery_timeframe": "<string>",
"description": "<string>",
"payment_collection": "hosted_page"
}
'import requests
url = "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}"
payload = {
"merchant_transaction_id": "<string>",
"amount": 500000,
"transaction_session": {
"request_ip_address": "<string>",
"browser_profile": {
"name": "<string>",
"version": "<string>",
"language": "<string>",
"user_agent": "<string>",
"java_enabled": True,
"is_webview": True
},
"screen_width": 32767,
"screen_height": 32767,
"screen_color_depth": 32767,
"accept_headers": "<string>",
"time_zone_offset": 0
},
"order_id": "<string>",
"order": {
"merchant_order_id": "<string>",
"payer_fingerprint": "<string>",
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 123,
"card_cardholder_name": "<string>",
"card_profile": { "fingerprint": "<string>" },
"cvv": "<string>"
},
"description": "<string>"
},
"delivery_address_usage_indicator": "<string>",
"delivery_timeframe": "<string>",
"description": "<string>",
"payment_collection": "hosted_page"
}
headers = {
"x-signature": "<api-key>",
"x-timestamp": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-signature': '<api-key>',
'x-timestamp': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_transaction_id: '<string>',
amount: 500000,
transaction_session: {
request_ip_address: '<string>',
browser_profile: {
name: '<string>',
version: '<string>',
language: '<string>',
user_agent: '<string>',
java_enabled: true,
is_webview: true
},
screen_width: 32767,
screen_height: 32767,
screen_color_depth: 32767,
accept_headers: '<string>',
time_zone_offset: 0
},
order_id: '<string>',
order: {
merchant_order_id: '<string>',
payer_fingerprint: '<string>',
payment_instrument: {
card_number: '<string>',
expiry_month: 6,
expiry_year: 123,
card_cardholder_name: '<string>',
card_profile: {fingerprint: '<string>'},
cvv: '<string>'
},
description: '<string>'
},
delivery_address_usage_indicator: '<string>',
delivery_timeframe: '<string>',
description: '<string>',
payment_collection: 'hosted_page'
})
};
fetch('https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'merchant_transaction_id' => '<string>',
'amount' => 500000,
'transaction_session' => [
'request_ip_address' => '<string>',
'browser_profile' => [
'name' => '<string>',
'version' => '<string>',
'language' => '<string>',
'user_agent' => '<string>',
'java_enabled' => true,
'is_webview' => true
],
'screen_width' => 32767,
'screen_height' => 32767,
'screen_color_depth' => 32767,
'accept_headers' => '<string>',
'time_zone_offset' => 0
],
'order_id' => '<string>',
'order' => [
'merchant_order_id' => '<string>',
'payer_fingerprint' => '<string>',
'payment_instrument' => [
'card_number' => '<string>',
'expiry_month' => 6,
'expiry_year' => 123,
'card_cardholder_name' => '<string>',
'card_profile' => [
'fingerprint' => '<string>'
],
'cvv' => '<string>'
],
'description' => '<string>'
],
'delivery_address_usage_indicator' => '<string>',
'delivery_timeframe' => '<string>',
'description' => '<string>',
'payment_collection' => 'hosted_page'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-signature: <api-key>",
"x-timestamp: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}"
payload := strings.NewReader("{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-signature", "<api-key>")
req.Header.Add("x-timestamp", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}")
.header("x-signature", "<api-key>")
.header("x-timestamp", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-signature"] = '<api-key>'
request["x-timestamp"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "<string>",
"accepted": true,
"order_id": "<string>",
"merchant_transaction_id": "<string>",
"merchant_order_id": "<string>",
"hosted_page_url": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}Payment instrument
order.payment_instrument accepts exactly one credential source: raw card details, a SmartRetry
token, or a processor provider_token (with its merchant_account, provider_key, and for Adyen provider_shopper_reference). An optional cvv can accompany any of them. See
Payment methods for the full field reference.
Provide either order.payer or order.payer_fingerprint — not both. payer_fingerprint is a
pre-computed identifier from an earlier transaction for the same payer.
payment_collection: hosted_page makes the credential optional at create time and rejects
token/provider_token — the payer supplies a fresh credential later through the hosted payment
page, and the transaction is persisted awaiting that submission until then.The response includes hosted_page_url. Redirect the payer to that URL instead of building it yourself.Retry a previous sale
Use this same endpoint to create a new retry attempt. In the request body, provideretry.originating_id for a previous SmartRetry transaction. You can also import the originating
attempt from a payment provider by providing retry.provider_key and either
retry.provider_transaction_id or a non-empty retry.interactions history.
Idempotency-Key. See Idempotency.accepted: true means SmartRetry has accepted the transaction for processing. To confirm whether the payment was approved by the issuer, fetch the transaction status using the returned transaction_id.Authorizations
Lowercase hex HMAC-SHA256 of {x-timestamp}.{METHOD}.{path_with_query}.{raw_body} keyed with your API secret. See https://www.smartretry.com/docs/authentication.
Current Unix time in seconds; must be within 5 minutes of server time and match the value used in the signature.
Headers
Optional idempotency key, scoped to terminal + matched route pattern. A replayed request returns the cached response with Idempotency-Replayed: true. Send it exactly once (a repeated header is rejected); 1-255 characters, letters, digits, _ and - only.
1 - 255^[\w-]+$Path Parameters
The unique identifier of the terminal.
6^[\dA-Za-z]{6}$Body
- Option 1
- Option 2
- Option 3
order.payment_instrument must be supplied, as a raw card, a SmartRetry token, or a provider_token, unless payment_collection is hosted_page.
A unique identifier for the transaction generated by the merchant.
100The amount to be charged, in major currency units (e.g. 10.00 for $10.00 USD).
0.01 <= x <= 999999.99AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USN, UYI, UYU, UYW, UZS, VED, VES, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWL Show child attributes
Show child attributes
A unique identifier for the order generated by SmartRetry. Additional notes internally this is friendly_id for order and not the actual order_id in the database.
8^[\dA-Za-z]{8}$Show child attributes
Show child attributes
01, 02, 03, 04, 05, 06, 07, 08, 09 Indicates how long the shipping address has been associated with the customer.
Indicates the delivery timeframe for the order.
Show child attributes
Show child attributes
A description of the transaction.
500hosted_page Response
Default Response
8^[\dA-Za-z]{8}$8^[\dA-Za-z]{8}$Payment page link for the payer. Present only for a hosted_page transaction awaiting the payer.
curl --request POST \
--url https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id} \
--header 'Content-Type: application/json' \
--header 'x-signature: <api-key>' \
--header 'x-timestamp: <api-key>' \
--data '
{
"merchant_transaction_id": "<string>",
"amount": 500000,
"transaction_session": {
"request_ip_address": "<string>",
"browser_profile": {
"name": "<string>",
"version": "<string>",
"language": "<string>",
"user_agent": "<string>",
"java_enabled": true,
"is_webview": true
},
"screen_width": 32767,
"screen_height": 32767,
"screen_color_depth": 32767,
"accept_headers": "<string>",
"time_zone_offset": 0
},
"order_id": "<string>",
"order": {
"merchant_order_id": "<string>",
"payer_fingerprint": "<string>",
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 123,
"card_cardholder_name": "<string>",
"card_profile": {
"fingerprint": "<string>"
},
"cvv": "<string>"
},
"description": "<string>"
},
"delivery_address_usage_indicator": "<string>",
"delivery_timeframe": "<string>",
"description": "<string>",
"payment_collection": "hosted_page"
}
'import requests
url = "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}"
payload = {
"merchant_transaction_id": "<string>",
"amount": 500000,
"transaction_session": {
"request_ip_address": "<string>",
"browser_profile": {
"name": "<string>",
"version": "<string>",
"language": "<string>",
"user_agent": "<string>",
"java_enabled": True,
"is_webview": True
},
"screen_width": 32767,
"screen_height": 32767,
"screen_color_depth": 32767,
"accept_headers": "<string>",
"time_zone_offset": 0
},
"order_id": "<string>",
"order": {
"merchant_order_id": "<string>",
"payer_fingerprint": "<string>",
"payment_instrument": {
"card_number": "<string>",
"expiry_month": 6,
"expiry_year": 123,
"card_cardholder_name": "<string>",
"card_profile": { "fingerprint": "<string>" },
"cvv": "<string>"
},
"description": "<string>"
},
"delivery_address_usage_indicator": "<string>",
"delivery_timeframe": "<string>",
"description": "<string>",
"payment_collection": "hosted_page"
}
headers = {
"x-signature": "<api-key>",
"x-timestamp": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-signature': '<api-key>',
'x-timestamp': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_transaction_id: '<string>',
amount: 500000,
transaction_session: {
request_ip_address: '<string>',
browser_profile: {
name: '<string>',
version: '<string>',
language: '<string>',
user_agent: '<string>',
java_enabled: true,
is_webview: true
},
screen_width: 32767,
screen_height: 32767,
screen_color_depth: 32767,
accept_headers: '<string>',
time_zone_offset: 0
},
order_id: '<string>',
order: {
merchant_order_id: '<string>',
payer_fingerprint: '<string>',
payment_instrument: {
card_number: '<string>',
expiry_month: 6,
expiry_year: 123,
card_cardholder_name: '<string>',
card_profile: {fingerprint: '<string>'},
cvv: '<string>'
},
description: '<string>'
},
delivery_address_usage_indicator: '<string>',
delivery_timeframe: '<string>',
description: '<string>',
payment_collection: 'hosted_page'
})
};
fetch('https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'merchant_transaction_id' => '<string>',
'amount' => 500000,
'transaction_session' => [
'request_ip_address' => '<string>',
'browser_profile' => [
'name' => '<string>',
'version' => '<string>',
'language' => '<string>',
'user_agent' => '<string>',
'java_enabled' => true,
'is_webview' => true
],
'screen_width' => 32767,
'screen_height' => 32767,
'screen_color_depth' => 32767,
'accept_headers' => '<string>',
'time_zone_offset' => 0
],
'order_id' => '<string>',
'order' => [
'merchant_order_id' => '<string>',
'payer_fingerprint' => '<string>',
'payment_instrument' => [
'card_number' => '<string>',
'expiry_month' => 6,
'expiry_year' => 123,
'card_cardholder_name' => '<string>',
'card_profile' => [
'fingerprint' => '<string>'
],
'cvv' => '<string>'
],
'description' => '<string>'
],
'delivery_address_usage_indicator' => '<string>',
'delivery_timeframe' => '<string>',
'description' => '<string>',
'payment_collection' => 'hosted_page'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-signature: <api-key>",
"x-timestamp: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}"
payload := strings.NewReader("{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-signature", "<api-key>")
req.Header.Add("x-timestamp", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}")
.header("x-signature", "<api-key>")
.header("x-timestamp", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://terminal.smartretry.com/v1/payments/sale/{terminal_friendly_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-signature"] = '<api-key>'
request["x-timestamp"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_transaction_id\": \"<string>\",\n \"amount\": 500000,\n \"transaction_session\": {\n \"request_ip_address\": \"<string>\",\n \"browser_profile\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\",\n \"language\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"java_enabled\": true,\n \"is_webview\": true\n },\n \"screen_width\": 32767,\n \"screen_height\": 32767,\n \"screen_color_depth\": 32767,\n \"accept_headers\": \"<string>\",\n \"time_zone_offset\": 0\n },\n \"order_id\": \"<string>\",\n \"order\": {\n \"merchant_order_id\": \"<string>\",\n \"payer_fingerprint\": \"<string>\",\n \"payment_instrument\": {\n \"card_number\": \"<string>\",\n \"expiry_month\": 6,\n \"expiry_year\": 123,\n \"card_cardholder_name\": \"<string>\",\n \"card_profile\": {\n \"fingerprint\": \"<string>\"\n },\n \"cvv\": \"<string>\"\n },\n \"description\": \"<string>\"\n },\n \"delivery_address_usage_indicator\": \"<string>\",\n \"delivery_timeframe\": \"<string>\",\n \"description\": \"<string>\",\n \"payment_collection\": \"hosted_page\"\n}"
response = http.request(request)
puts response.read_body{
"transaction_id": "<string>",
"accepted": true,
"order_id": "<string>",
"merchant_transaction_id": "<string>",
"merchant_order_id": "<string>",
"hosted_page_url": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason_code": "SYSTEM/SUCCESSFUL",
"instance": "<string>",
"context": {}
}