Create a payment intent
curl --request POST \
--url https://api.example.com/v1/sdk/payment-intents \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"customerRef": "<string>",
"amount": 5000050,
"currency": "<string>",
"description": "<string>",
"planRef": "<string>",
"pricingTier": "<string>",
"productRef": "<string>",
"purpose": "product"
}
'import requests
url = "https://api.example.com/v1/sdk/payment-intents"
payload = {
"customerRef": "<string>",
"amount": 5000050,
"currency": "<string>",
"description": "<string>",
"planRef": "<string>",
"pricingTier": "<string>",
"productRef": "<string>",
"purpose": "product"
}
headers = {
"idempotency-key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'idempotency-key': '<idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerRef: '<string>',
amount: 5000050,
currency: '<string>',
description: '<string>',
planRef: '<string>',
pricingTier: '<string>',
productRef: '<string>',
purpose: 'product'
})
};
fetch('https://api.example.com/v1/sdk/payment-intents', 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.example.com/v1/sdk/payment-intents",
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([
'customerRef' => '<string>',
'amount' => 5000050,
'currency' => '<string>',
'description' => '<string>',
'planRef' => '<string>',
'pricingTier' => '<string>',
'productRef' => '<string>',
'purpose' => 'product'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"idempotency-key: <idempotency-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://api.example.com/v1/sdk/payment-intents"
payload := strings.NewReader("{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-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://api.example.com/v1/sdk/payment-intents")
.header("idempotency-key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sdk/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}"
response = http.request(request)
puts response.read_bodyPayment Intents
Create a payment intent
Creates a new payment intent for a customer to purchase a plan. Requires an idempotency key to prevent duplicate charges. Returns client secret and publishable key needed for frontend integration.
POST
/
v1
/
sdk
/
payment-intents
Create a payment intent
curl --request POST \
--url https://api.example.com/v1/sdk/payment-intents \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"customerRef": "<string>",
"amount": 5000050,
"currency": "<string>",
"description": "<string>",
"planRef": "<string>",
"pricingTier": "<string>",
"productRef": "<string>",
"purpose": "product"
}
'import requests
url = "https://api.example.com/v1/sdk/payment-intents"
payload = {
"customerRef": "<string>",
"amount": 5000050,
"currency": "<string>",
"description": "<string>",
"planRef": "<string>",
"pricingTier": "<string>",
"productRef": "<string>",
"purpose": "product"
}
headers = {
"idempotency-key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'idempotency-key': '<idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customerRef: '<string>',
amount: 5000050,
currency: '<string>',
description: '<string>',
planRef: '<string>',
pricingTier: '<string>',
productRef: '<string>',
purpose: 'product'
})
};
fetch('https://api.example.com/v1/sdk/payment-intents', 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.example.com/v1/sdk/payment-intents",
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([
'customerRef' => '<string>',
'amount' => 5000050,
'currency' => '<string>',
'description' => '<string>',
'planRef' => '<string>',
'pricingTier' => '<string>',
'productRef' => '<string>',
'purpose' => 'product'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"idempotency-key: <idempotency-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://api.example.com/v1/sdk/payment-intents"
payload := strings.NewReader("{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-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://api.example.com/v1/sdk/payment-intents")
.header("idempotency-key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sdk/payment-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerRef\": \"<string>\",\n \"amount\": 5000050,\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"planRef\": \"<string>\",\n \"pricingTier\": \"<string>\",\n \"productRef\": \"<string>\",\n \"purpose\": \"product\"\n}"
response = http.request(request)
puts response.read_bodyHeaders
Unique idempotency key to prevent duplicate payments (required)
Body
application/json
Payment intent creation data
Minimum string length:
1Required range:
100 < x < 10000000Maximum string length:
500Minimum string length:
1Minimum string length:
1Available options:
product, credit_topup, usage_billing Response
Payment intent created successfully
List payment intents for the provider
Previous
Process payment intent after client-side confirmation
Next
⌘I