cURL
curl --request POST \
--url https://api.xpaycheckout.com/subscription/merchant/one-time-charge \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriptionId": "sub_fooBOwYsaK50AEfK",
"amount": 500,
"currency": "USD",
"comments": "One-time setup fee for premium add-on"
}
'import requests
url = "https://api.xpaycheckout.com/subscription/merchant/one-time-charge"
payload = {
"subscriptionId": "sub_fooBOwYsaK50AEfK",
"amount": 500,
"currency": "USD",
"comments": "One-time setup fee for premium add-on"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriptionId: 'sub_fooBOwYsaK50AEfK',
amount: 500,
currency: 'USD',
comments: 'One-time setup fee for premium add-on'
})
};
fetch('https://api.xpaycheckout.com/subscription/merchant/one-time-charge', 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://api.xpaycheckout.com/subscription/merchant/one-time-charge",
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([
'subscriptionId' => 'sub_fooBOwYsaK50AEfK',
'amount' => 500,
'currency' => 'USD',
'comments' => 'One-time setup fee for premium add-on'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api.xpaycheckout.com/subscription/merchant/one-time-charge"
payload := strings.NewReader("{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.xpaycheckout.com/subscription/merchant/one-time-charge")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpaycheckout.com/subscription/merchant/one-time-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}"
response = http.request(request)
puts response.read_body{
"intentId": "in_gKAqR0DjLeOihdTE",
"status": "SUCCESS",
"errorCode": null,
"errorMessage": null
}Subscriptions
One Time Charge
Charge a one-time amount against an existing subscription using its saved payment method.
POST
/
subscription
/
merchant
/
one-time-charge
cURL
curl --request POST \
--url https://api.xpaycheckout.com/subscription/merchant/one-time-charge \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriptionId": "sub_fooBOwYsaK50AEfK",
"amount": 500,
"currency": "USD",
"comments": "One-time setup fee for premium add-on"
}
'import requests
url = "https://api.xpaycheckout.com/subscription/merchant/one-time-charge"
payload = {
"subscriptionId": "sub_fooBOwYsaK50AEfK",
"amount": 500,
"currency": "USD",
"comments": "One-time setup fee for premium add-on"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriptionId: 'sub_fooBOwYsaK50AEfK',
amount: 500,
currency: 'USD',
comments: 'One-time setup fee for premium add-on'
})
};
fetch('https://api.xpaycheckout.com/subscription/merchant/one-time-charge', 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://api.xpaycheckout.com/subscription/merchant/one-time-charge",
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([
'subscriptionId' => 'sub_fooBOwYsaK50AEfK',
'amount' => 500,
'currency' => 'USD',
'comments' => 'One-time setup fee for premium add-on'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api.xpaycheckout.com/subscription/merchant/one-time-charge"
payload := strings.NewReader("{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.xpaycheckout.com/subscription/merchant/one-time-charge")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpaycheckout.com/subscription/merchant/one-time-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriptionId\": \"sub_fooBOwYsaK50AEfK\",\n \"amount\": 500,\n \"currency\": \"USD\",\n \"comments\": \"One-time setup fee for premium add-on\"\n}"
response = http.request(request)
puts response.read_body{
"intentId": "in_gKAqR0DjLeOihdTE",
"status": "SUCCESS",
"errorCode": null,
"errorMessage": null
}This feature is disabled by default. To turn it on for your account, please contact your account manager or hello@xpaycheckout.com.
Authorizations
Headers
A unique key for making the request idempotent. Must match pattern: ^[a-zA-Z0-9\-_:\.]+$. See Idempotent Requests for more details.
Maximum string length:
255Pattern:
^[a-zA-Z0-9\-_:\.]+$Body
application/json
Subscription One Time Charge
Response
Subscription One Time Charge response
The status of the payment intent. Refer payment intent status
Example:
"SUCCESS"
Machine readable failure reason when status is FAILED. null on a successful charge. See all possible values here.
Example:
"card_declined"
Was this page helpful?