curl --request POST \
--url https://api.piriod.com/sources/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"gateway": "<string>",
"customer": "<string>",
"usage": "single",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"client": {},
"metadata": {}
}
'import requests
url = "https://api.piriod.com/sources/"
payload = {
"gateway": "<string>",
"customer": "<string>",
"usage": "single",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"client": {},
"metadata": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
gateway: '<string>',
customer: '<string>',
usage: 'single',
amount: 123,
description: '<string>',
return_url: '<string>',
client: {},
metadata: {}
})
};
fetch('https://api.piriod.com/sources/', 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.piriod.com/sources/",
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([
'gateway' => '<string>',
'customer' => '<string>',
'usage' => 'single',
'amount' => 123,
'description' => '<string>',
'return_url' => '<string>',
'client' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.piriod.com/sources/"
payload := strings.NewReader("{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-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.piriod.com/sources/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.piriod.com/sources/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"gateway": "<string>",
"id": 123,
"customer": "<string>",
"usage": "single",
"status": "failed",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"gateway_data": {},
"client": {},
"metadata": {},
"card": {
"brand": "<string>",
"last4": "<string>",
"exp_month": 123,
"exp_year": 123
},
"test_mode": true,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}{
"name": [
"This field is required."
],
"non_field_errors": [
"x-simple-workspace header is required."
]
}Create source (publishable)
Creates a payment source. This endpoint accepts unauthenticated calls from the browser (publishable flow), so the request is identified by the gateway/customer/payment context rather than a workspace header.
curl --request POST \
--url https://api.piriod.com/sources/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"gateway": "<string>",
"customer": "<string>",
"usage": "single",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"client": {},
"metadata": {}
}
'import requests
url = "https://api.piriod.com/sources/"
payload = {
"gateway": "<string>",
"customer": "<string>",
"usage": "single",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"client": {},
"metadata": {}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
gateway: '<string>',
customer: '<string>',
usage: 'single',
amount: 123,
description: '<string>',
return_url: '<string>',
client: {},
metadata: {}
})
};
fetch('https://api.piriod.com/sources/', 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.piriod.com/sources/",
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([
'gateway' => '<string>',
'customer' => '<string>',
'usage' => 'single',
'amount' => 123,
'description' => '<string>',
'return_url' => '<string>',
'client' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.piriod.com/sources/"
payload := strings.NewReader("{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-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.piriod.com/sources/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.piriod.com/sources/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"gateway\": \"<string>\",\n \"customer\": \"<string>\",\n \"usage\": \"single\",\n \"amount\": 123,\n \"description\": \"<string>\",\n \"return_url\": \"<string>\",\n \"client\": {},\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"gateway": "<string>",
"id": 123,
"customer": "<string>",
"usage": "single",
"status": "failed",
"amount": 123,
"description": "<string>",
"return_url": "<string>",
"gateway_data": {},
"client": {},
"metadata": {},
"card": {
"brand": "<string>",
"last4": "<string>",
"exp_month": 123,
"exp_year": 123
},
"test_mode": true,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}{
"name": [
"This field is required."
],
"non_field_errors": [
"x-simple-workspace header is required."
]
}Authorizations
Use header Authorization: Token <api_token>.
API tokens are obtained from the Piriod dashboard.
Body
A payment source: either a single-use intent (e.g. one-off bank transfer) or a reusable tokenization (e.g. saved card).
Gateway ID (e.g. transbank, stripe, ach_transfer).
Customer ID. Required for reusable sources.
single, reusable 256URL the payer is sent to after a redirect-flow tokenization.
Client metadata captured at creation time (IP, user agent, etc.).
Response
Source created.
A payment source: either a single-use intent (e.g. one-off bank transfer) or a reusable tokenization (e.g. saved card).
Gateway ID (e.g. transbank, stripe, ach_transfer).
Customer ID. Required for reusable sources.
single, reusable failed, pending, requires_authorization, waiting_authorization, consumed, chargeable, finalized 256URL the payer is sent to after a redirect-flow tokenization.
Gateway-specific payload (e.g. redirect form fields, token).
Client metadata captured at creation time (IP, user agent, etc.).
Card details when the source represents a tokenized card.
Show child attributes
Show child attributes
