Creates a payment session
curl --request POST \
--url https://api.sprintcheckout.com/api/checkout/v2/payment_session \
--header 'Content-Type: application/json' \
--header 'X-SC-ApiKey: <x-sc-apikey>' \
--data '
{
"amount": 100.5,
"currency": "USD",
"orderType": "STATIC",
"minAmount": 100.5,
"editable": true,
"orderId": "inv-00010",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api.sprintcheckout.com/api/checkout/v2/payment_session"
payload = {
"amount": 100.5,
"currency": "USD",
"orderType": "STATIC",
"minAmount": 100.5,
"editable": True,
"orderId": "inv-00010",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
headers = {
"X-SC-ApiKey": "<x-sc-apikey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SC-ApiKey': '<x-sc-apikey>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100.5,
currency: 'USD',
orderType: 'STATIC',
minAmount: 100.5,
editable: true,
orderId: 'inv-00010',
successUrl: '<string>',
cancelUrl: '<string>'
})
};
fetch('https://api.sprintcheckout.com/api/checkout/v2/payment_session', 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.sprintcheckout.com/api/checkout/v2/payment_session",
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([
'amount' => 100.5,
'currency' => 'USD',
'orderType' => 'STATIC',
'minAmount' => 100.5,
'editable' => true,
'orderId' => 'inv-00010',
'successUrl' => '<string>',
'cancelUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SC-ApiKey: <x-sc-apikey>"
],
]);
$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.sprintcheckout.com/api/checkout/v2/payment_session"
payload := strings.NewReader("{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SC-ApiKey", "<x-sc-apikey>")
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.sprintcheckout.com/api/checkout/v2/payment_session")
.header("X-SC-ApiKey", "<x-sc-apikey>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprintcheckout.com/api/checkout/v2/payment_session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SC-ApiKey"] = '<x-sc-apikey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"redirectUrl": "<string>"
}API integration
Create payment session
To get paid in cryptocurrency, you need to create a payment session object with the details of the purchase.
POST
/
api
/
checkout
/
v2
/
payment_session
Creates a payment session
curl --request POST \
--url https://api.sprintcheckout.com/api/checkout/v2/payment_session \
--header 'Content-Type: application/json' \
--header 'X-SC-ApiKey: <x-sc-apikey>' \
--data '
{
"amount": 100.5,
"currency": "USD",
"orderType": "STATIC",
"minAmount": 100.5,
"editable": true,
"orderId": "inv-00010",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api.sprintcheckout.com/api/checkout/v2/payment_session"
payload = {
"amount": 100.5,
"currency": "USD",
"orderType": "STATIC",
"minAmount": 100.5,
"editable": True,
"orderId": "inv-00010",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
headers = {
"X-SC-ApiKey": "<x-sc-apikey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SC-ApiKey': '<x-sc-apikey>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100.5,
currency: 'USD',
orderType: 'STATIC',
minAmount: 100.5,
editable: true,
orderId: 'inv-00010',
successUrl: '<string>',
cancelUrl: '<string>'
})
};
fetch('https://api.sprintcheckout.com/api/checkout/v2/payment_session', 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.sprintcheckout.com/api/checkout/v2/payment_session",
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([
'amount' => 100.5,
'currency' => 'USD',
'orderType' => 'STATIC',
'minAmount' => 100.5,
'editable' => true,
'orderId' => 'inv-00010',
'successUrl' => '<string>',
'cancelUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SC-ApiKey: <x-sc-apikey>"
],
]);
$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.sprintcheckout.com/api/checkout/v2/payment_session"
payload := strings.NewReader("{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SC-ApiKey", "<x-sc-apikey>")
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.sprintcheckout.com/api/checkout/v2/payment_session")
.header("X-SC-ApiKey", "<x-sc-apikey>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sprintcheckout.com/api/checkout/v2/payment_session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SC-ApiKey"] = '<x-sc-apikey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100.5,\n \"currency\": \"USD\",\n \"orderType\": \"STATIC\",\n \"minAmount\": 100.5,\n \"editable\": true,\n \"orderId\": \"inv-00010\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sessionId": "<string>",
"redirectUrl": "<string>"
}Headers
Get an Api Key from Sprintcheckout Dashboard > Get paid
Body
application/json
Amount of the purchase
Example:
100.5
Three letter FIAT currency code
Example:
"USD"
An order can be STATIC or TRANSIENT (default behavior). A static order will not expire. A typical example could be a donation scenario. A transient order will not be reusable once is paid.
Pattern:
STATIC|TRANSIENTExample:
"STATIC"
Minimum amount of the payment
Example:
100.5
Is the payment input editable in UI?
Unique reference of the order on your ecommerce platform
Example:
"inv-00010"
URL where the user will be redirected from the hosted payment page on a successful payment
URL where the user will be redirected from the hosted payment page on a canceled payment
⌘I