Invalid TTLs will be set to 7 days.
Copy const url = "https://staging.branta.pro/v1/payments" ;
const apiToken = "your token here" ;
const payload = {
"payment" : {
"merchant" : "A Store" ,
"payment" : "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" ,
"ttl" : "86400" ,
"description" : "Payment for Invoice #123"
}
}
const options = {
method : "POST" ,
headers : {
"API_KEY" : apiToken ,
"Content-Type" : "application/json"
} ,
body : JSON .stringify (payload)
};
fetch (url , options)
.then (response => {
console .log ( "Response Status Code:" , response .status);
})
.catch (error => {
console .error ( "An error occurred:" , error);
});
Copy import requests
url = "https://staging.branta.pro/v1/payments"
api_token = "your token here"
payload = {
"payment" : {
"uuid" : "123" ,
"merchant" : "A Store" ,
"payment" : "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" ,
"ttl" : "86400" ,
"description" : "Payment for Invoice #123"
}
}
headers = {
"API_KEY" : api_token ,
"Content-Type" : "application/json"
}
try :
response = requests . post (url, json = payload, headers = headers)
print ( "Response:" , response.status_code)
except requests . exceptions . RequestException as e :
print ( "An error occurred:" , e)
Copy require 'net/http'
require 'uri'
require 'json'
url = URI . parse ( "https://staging.branta.pro/v1/payments" )
api_token = "your token here"
payload = {
"payment" : {
"merchant" : "A Store" ,
"payment" : "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" ,
"ttl" : "86400" ,
"description" : "Payment for Invoice #123"
}
}
http = Net :: HTTP . new (url . host , url . port )
http . use_ssl = true
request = Net :: HTTP :: Post . new (url . path , {
"API_KEY" => api_token ,
"Content-Type" => "application/json"
})
request . body = payload . to_json
begin
response = http . request (request)
puts "Response Status Code: #{response . code } "
rescue => e
puts "An error occurred: #{e . message } "
end