Checkout Sessions
curl --request POST \
--url https://api.viarosandbox.com/v1/checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"currency": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"customer_email": "<string>",
"client_reference_id": "<string>",
"line_items": [
{
"name": "<string>",
"amount": 123,
"quantity": 123
}
],
"metadata": {}
}
'import requests
url = "https://api.viarosandbox.com/v1/checkout/sessions"
payload = {
"amount": 123,
"currency": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"customer_email": "<string>",
"client_reference_id": "<string>",
"line_items": [
{
"name": "<string>",
"amount": 123,
"quantity": 123
}
],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
currency: '<string>',
success_url: '<string>',
cancel_url: '<string>',
customer_email: '<string>',
client_reference_id: '<string>',
line_items: [{name: '<string>', amount: 123, quantity: 123}],
metadata: {}
})
};
fetch('https://api.viarosandbox.com/v1/checkout/sessions', 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.viarosandbox.com/v1/checkout/sessions",
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' => 123,
'currency' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'customer_email' => '<string>',
'client_reference_id' => '<string>',
'line_items' => [
[
'name' => '<string>',
'amount' => 123,
'quantity' => 123
]
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.viarosandbox.com/v1/checkout/sessions"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.viarosandbox.com/v1/checkout/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/checkout/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"response_type": "success",
"data": {
"id": "cs_0b327b82-8419-4bf9-8b83-b7b51b72b012",
"object": "checkout.session",
"payment_intent": "0b327b82-8419-4bf9-8b83-b7b51b72b012",
"amount_total": 15000.0,
"currency": "XAF",
"customer_email": "[email protected]",
"payment_status": "unpaid",
"status": "open",
"success_url": "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://example.com/checkout/cancel",
"url": "https://checkout.viarosandbox.com/pay/0b327b82-8419-4bf9-8b83-b7b51b72b012?client_secret=...",
"client_secret": "pi_0b327b82_secret_...",
"created": 1793966500
}
}
Checkout & Payment Links
Checkout Sessions
Create a hosted Checkout Session to securely collect payments with Pursar’s pre-built payment page.
POST
/
checkout
/
sessions
Checkout Sessions
curl --request POST \
--url https://api.viarosandbox.com/v1/checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"currency": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"customer_email": "<string>",
"client_reference_id": "<string>",
"line_items": [
{
"name": "<string>",
"amount": 123,
"quantity": 123
}
],
"metadata": {}
}
'import requests
url = "https://api.viarosandbox.com/v1/checkout/sessions"
payload = {
"amount": 123,
"currency": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"customer_email": "<string>",
"client_reference_id": "<string>",
"line_items": [
{
"name": "<string>",
"amount": 123,
"quantity": 123
}
],
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
currency: '<string>',
success_url: '<string>',
cancel_url: '<string>',
customer_email: '<string>',
client_reference_id: '<string>',
line_items: [{name: '<string>', amount: 123, quantity: 123}],
metadata: {}
})
};
fetch('https://api.viarosandbox.com/v1/checkout/sessions', 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.viarosandbox.com/v1/checkout/sessions",
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' => 123,
'currency' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'customer_email' => '<string>',
'client_reference_id' => '<string>',
'line_items' => [
[
'name' => '<string>',
'amount' => 123,
'quantity' => 123
]
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.viarosandbox.com/v1/checkout/sessions"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.viarosandbox.com/v1/checkout/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/checkout/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"customer_email\": \"<string>\",\n \"client_reference_id\": \"<string>\",\n \"line_items\": [\n {\n \"name\": \"<string>\",\n \"amount\": 123,\n \"quantity\": 123\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"status_code": 201,
"response_type": "success",
"data": {
"id": "cs_0b327b82-8419-4bf9-8b83-b7b51b72b012",
"object": "checkout.session",
"payment_intent": "0b327b82-8419-4bf9-8b83-b7b51b72b012",
"amount_total": 15000.0,
"currency": "XAF",
"customer_email": "[email protected]",
"payment_status": "unpaid",
"status": "open",
"success_url": "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://example.com/checkout/cancel",
"url": "https://checkout.viarosandbox.com/pay/0b327b82-8419-4bf9-8b83-b7b51b72b012?client_secret=...",
"client_secret": "pi_0b327b82_secret_...",
"created": 1793966500
}
}
A Checkout Session represents your customer’s session as they pay for one-time purchases or subscriptions through Pursar’s hosted checkout page. When you create a Checkout Session, Pursar returns a
url to which you redirect your customer.
After the customer completes their payment, Pursar redirects them to your specified success_url with the checkout session ID.
Authentication
Pursar follows the Stripe standard HTTP Basic Authentication format. Pass your Secret Key as the Basic Auth username (with an empty password), or in theAuthorization: Bearer header.
Request Body
number
required
The total amount to charge in the currency’s standard or minor unit (e.g.,
15000 for 15,000 XAF).string
default:"XAF"
Three-letter ISO currency code (
XAF, XOF, GHS, KES, USD, EUR).string
required
The URL to which Pursar redirects your customer when the payment is successful. You can include
{CHECKOUT_SESSION_ID} as a template parameter.string
The URL to which Pursar redirects your customer if they choose to cancel or abandon the checkout page.
string
If provided, this email is pre-filled on the hosted checkout page.
string
A unique string to reference the Checkout Session on your system.
array
object
Key-value pairs for attaching custom data to the session and downstream transaction.
Code Examples
curl -X POST https://api.viarosandbox.com/v1/checkout/sessions \
-u sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG: \
-H "Content-Type: application/json" \
-d '{
"amount": 15000,
"currency": "XAF",
"customer_email": "[email protected]",
"success_url": "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://example.com/checkout/cancel",
"metadata": {
"order_id": "ord_991823"
}
}'
import requests
api_key = "sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG"
url = "https://api.viarosandbox.com/v1/checkout/sessions"
payload = {
"amount": 15000,
"currency": "XAF",
"customer_email": "[email protected]",
"success_url": "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://example.com/checkout/cancel",
"metadata": {
"order_id": "ord_991823"
}
}
response = requests.post(url, auth=(api_key, ""), json=payload)
session = response.json()["data"]
print("Redirect URL:", session["url"])
const apiKey = "sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG";
const res = await fetch("https://api.viarosandbox.com/v1/checkout/sessions", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
amount: 15000,
currency: "XAF",
customer_email: "[email protected]",
success_url: "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
cancel_url: "https://example.com/checkout/cancel"
})
});
const session = (await res.json()).data;
console.log("Hosted Checkout URL:", session.url);
Response Example
{
"status_code": 201,
"response_type": "success",
"data": {
"id": "cs_0b327b82-8419-4bf9-8b83-b7b51b72b012",
"object": "checkout.session",
"payment_intent": "0b327b82-8419-4bf9-8b83-b7b51b72b012",
"amount_total": 15000.0,
"currency": "XAF",
"customer_email": "[email protected]",
"payment_status": "unpaid",
"status": "open",
"success_url": "https://example.com/checkout/success?session_id={CHECKOUT_SESSION_ID}",
"cancel_url": "https://example.com/checkout/cancel",
"url": "https://checkout.viarosandbox.com/pay/0b327b82-8419-4bf9-8b83-b7b51b72b012?client_secret=...",
"client_secret": "pi_0b327b82_secret_...",
"created": 1793966500
}
}

