Create a Payment Method (tokenize)
curl --request POST \
--url https://sandbox.api.hixbe.com/payment/payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Xerobi-Version: <xerobi-version>' \
--data '
{
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
}
'import requests
url = "https://sandbox.api.hixbe.com/payment/payment_methods"
payload = {
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
}
headers = {
"Xerobi-Version": "<xerobi-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Xerobi-Version': '<xerobi-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'card',
card: {number: '4242424242424242', exp_month: 12, exp_year: 2027, cvc: '123'}
})
};
fetch('https://sandbox.api.hixbe.com/payment/payment_methods', 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://sandbox.api.hixbe.com/payment/payment_methods",
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([
'type' => 'card',
'card' => [
'number' => '4242424242424242',
'exp_month' => 12,
'exp_year' => 2027,
'cvc' => '123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Xerobi-Version: <xerobi-version>"
],
]);
$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://sandbox.api.hixbe.com/payment/payment_methods"
payload := strings.NewReader("{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Xerobi-Version", "<xerobi-version>")
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://sandbox.api.hixbe.com/payment/payment_methods")
.header("Xerobi-Version", "<xerobi-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.hixbe.com/payment/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Xerobi-Version"] = '<xerobi-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "pm_card_123",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2027
},
"created_at": "2023-11-07T05:31:56Z",
"customer": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Create Payment Method
Create a vaultable payment method. In production, clients should use a frontend tokenization flow (PCI scope reduction).
POST
/
payment_methods
Create a Payment Method (tokenize)
curl --request POST \
--url https://sandbox.api.hixbe.com/payment/payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Xerobi-Version: <xerobi-version>' \
--data '
{
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
}
'import requests
url = "https://sandbox.api.hixbe.com/payment/payment_methods"
payload = {
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2027,
"cvc": "123"
}
}
headers = {
"Xerobi-Version": "<xerobi-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Xerobi-Version': '<xerobi-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'card',
card: {number: '4242424242424242', exp_month: 12, exp_year: 2027, cvc: '123'}
})
};
fetch('https://sandbox.api.hixbe.com/payment/payment_methods', 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://sandbox.api.hixbe.com/payment/payment_methods",
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([
'type' => 'card',
'card' => [
'number' => '4242424242424242',
'exp_month' => 12,
'exp_year' => 2027,
'cvc' => '123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Xerobi-Version: <xerobi-version>"
],
]);
$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://sandbox.api.hixbe.com/payment/payment_methods"
payload := strings.NewReader("{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Xerobi-Version", "<xerobi-version>")
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://sandbox.api.hixbe.com/payment/payment_methods")
.header("Xerobi-Version", "<xerobi-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.hixbe.com/payment/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Xerobi-Version"] = '<xerobi-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"card\",\n \"card\": {\n \"number\": \"4242424242424242\",\n \"exp_month\": 12,\n \"exp_year\": 2027,\n \"cvc\": \"123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "pm_card_123",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2027
},
"created_at": "2023-11-07T05:31:56Z",
"customer": "<string>"
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Authorizations
Use your secret API key. Example: Authorization: Bearer sk_test_xxx
Headers
API version header. Use '2026-01-01' for the latest version.
Optional client-provided request id for tracing.
Body
application/json