Create payment with DRP
curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create \
--header 'Content-Type: application/json' \
--data '
{
"version": "1.0",
"receiptId": "rcpt_payment_001",
"merchantId": "mer_001",
"merchantName": "Test Merchant",
"merchantStreet": "123 Main St",
"merchantCity": "San Francisco",
"merchantState": "CA",
"merchantPostalCode": "94105",
"merchantCountry": "US",
"transactionId": "txn_001",
"transactionDate": "2024-12-18T00:00:00Z",
"transactionTimezone": "UTC",
"paymentMethod": "card",
"currency": "USD",
"subtotal": 2000,
"taxAmount": 0,
"totalAmount": 2000,
"items": [
{
"lineItemId": "li_001",
"name": "Widget",
"quantity": 1,
"unitPrice": 1000,
"totalPrice": 1000
}
],
"recipientHashedPan": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"amount": 1000,
"cardNonce": "cnon:card-nonce-ok"
}
'import requests
url = "https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create"
payload = {
"version": "1.0",
"receiptId": "rcpt_payment_001",
"merchantId": "mer_001",
"merchantName": "Test Merchant",
"merchantStreet": "123 Main St",
"merchantCity": "San Francisco",
"merchantState": "CA",
"merchantPostalCode": "94105",
"merchantCountry": "US",
"transactionId": "txn_001",
"transactionDate": "2024-12-18T00:00:00Z",
"transactionTimezone": "UTC",
"paymentMethod": "card",
"currency": "USD",
"subtotal": 2000,
"taxAmount": 0,
"totalAmount": 2000,
"items": [
{
"lineItemId": "li_001",
"name": "Widget",
"quantity": 1,
"unitPrice": 1000,
"totalPrice": 1000
}
],
"recipientHashedPan": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"amount": 1000,
"cardNonce": "cnon:card-nonce-ok"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
version: '1.0',
receiptId: 'rcpt_payment_001',
merchantId: 'mer_001',
merchantName: 'Test Merchant',
merchantStreet: '123 Main St',
merchantCity: 'San Francisco',
merchantState: 'CA',
merchantPostalCode: '94105',
merchantCountry: 'US',
transactionId: 'txn_001',
transactionDate: '2024-12-18T00:00:00Z',
transactionTimezone: 'UTC',
paymentMethod: 'card',
currency: 'USD',
subtotal: 2000,
taxAmount: 0,
totalAmount: 2000,
items: [
{
lineItemId: 'li_001',
name: 'Widget',
quantity: 1,
unitPrice: 1000,
totalPrice: 1000
}
],
recipientHashedPan: '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
amount: 1000,
cardNonce: 'cnon:card-nonce-ok'
})
};
fetch('https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create', 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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create",
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([
'version' => '1.0',
'receiptId' => 'rcpt_payment_001',
'merchantId' => 'mer_001',
'merchantName' => 'Test Merchant',
'merchantStreet' => '123 Main St',
'merchantCity' => 'San Francisco',
'merchantState' => 'CA',
'merchantPostalCode' => '94105',
'merchantCountry' => 'US',
'transactionId' => 'txn_001',
'transactionDate' => '2024-12-18T00:00:00Z',
'transactionTimezone' => 'UTC',
'paymentMethod' => 'card',
'currency' => 'USD',
'subtotal' => 2000,
'taxAmount' => 0,
'totalAmount' => 2000,
'items' => [
[
'lineItemId' => 'li_001',
'name' => 'Widget',
'quantity' => 1,
'unitPrice' => 1000,
'totalPrice' => 1000
]
],
'recipientHashedPan' => '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
'amount' => 1000,
'cardNonce' => 'cnon:card-nonce-ok'
]),
CURLOPT_HTTPHEADER => [
"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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create"
payload := strings.NewReader("{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"paymentId": "<string>",
"clientSecret": "<string>",
"orderId": "<string>",
"drpMetadata": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Payment (Merchant, Gateway)
Create Payment
Create a payment (Stripe/Square) with encrypted receipt metadata. This endpoint encrypts the receipt, creates a payment intent/order on the gateway, and attaches DRP metadata for later retrieval.
POST
/
api
/
v1
/
payments
/
{gateway}
/
create
Create payment with DRP
curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create \
--header 'Content-Type: application/json' \
--data '
{
"version": "1.0",
"receiptId": "rcpt_payment_001",
"merchantId": "mer_001",
"merchantName": "Test Merchant",
"merchantStreet": "123 Main St",
"merchantCity": "San Francisco",
"merchantState": "CA",
"merchantPostalCode": "94105",
"merchantCountry": "US",
"transactionId": "txn_001",
"transactionDate": "2024-12-18T00:00:00Z",
"transactionTimezone": "UTC",
"paymentMethod": "card",
"currency": "USD",
"subtotal": 2000,
"taxAmount": 0,
"totalAmount": 2000,
"items": [
{
"lineItemId": "li_001",
"name": "Widget",
"quantity": 1,
"unitPrice": 1000,
"totalPrice": 1000
}
],
"recipientHashedPan": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"amount": 1000,
"cardNonce": "cnon:card-nonce-ok"
}
'import requests
url = "https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create"
payload = {
"version": "1.0",
"receiptId": "rcpt_payment_001",
"merchantId": "mer_001",
"merchantName": "Test Merchant",
"merchantStreet": "123 Main St",
"merchantCity": "San Francisco",
"merchantState": "CA",
"merchantPostalCode": "94105",
"merchantCountry": "US",
"transactionId": "txn_001",
"transactionDate": "2024-12-18T00:00:00Z",
"transactionTimezone": "UTC",
"paymentMethod": "card",
"currency": "USD",
"subtotal": 2000,
"taxAmount": 0,
"totalAmount": 2000,
"items": [
{
"lineItemId": "li_001",
"name": "Widget",
"quantity": 1,
"unitPrice": 1000,
"totalPrice": 1000
}
],
"recipientHashedPan": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"amount": 1000,
"cardNonce": "cnon:card-nonce-ok"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
version: '1.0',
receiptId: 'rcpt_payment_001',
merchantId: 'mer_001',
merchantName: 'Test Merchant',
merchantStreet: '123 Main St',
merchantCity: 'San Francisco',
merchantState: 'CA',
merchantPostalCode: '94105',
merchantCountry: 'US',
transactionId: 'txn_001',
transactionDate: '2024-12-18T00:00:00Z',
transactionTimezone: 'UTC',
paymentMethod: 'card',
currency: 'USD',
subtotal: 2000,
taxAmount: 0,
totalAmount: 2000,
items: [
{
lineItemId: 'li_001',
name: 'Widget',
quantity: 1,
unitPrice: 1000,
totalPrice: 1000
}
],
recipientHashedPan: '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
amount: 1000,
cardNonce: 'cnon:card-nonce-ok'
})
};
fetch('https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create', 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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create",
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([
'version' => '1.0',
'receiptId' => 'rcpt_payment_001',
'merchantId' => 'mer_001',
'merchantName' => 'Test Merchant',
'merchantStreet' => '123 Main St',
'merchantCity' => 'San Francisco',
'merchantState' => 'CA',
'merchantPostalCode' => '94105',
'merchantCountry' => 'US',
'transactionId' => 'txn_001',
'transactionDate' => '2024-12-18T00:00:00Z',
'transactionTimezone' => 'UTC',
'paymentMethod' => 'card',
'currency' => 'USD',
'subtotal' => 2000,
'taxAmount' => 0,
'totalAmount' => 2000,
'items' => [
[
'lineItemId' => 'li_001',
'name' => 'Widget',
'quantity' => 1,
'unitPrice' => 1000,
'totalPrice' => 1000
]
],
'recipientHashedPan' => '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
'amount' => 1000,
'cardNonce' => 'cnon:card-nonce-ok'
]),
CURLOPT_HTTPHEADER => [
"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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create"
payload := strings.NewReader("{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.digitalreceiptprotocol.org/api/v1/payments/{gateway}/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": \"1.0\",\n \"receiptId\": \"rcpt_payment_001\",\n \"merchantId\": \"mer_001\",\n \"merchantName\": \"Test Merchant\",\n \"merchantStreet\": \"123 Main St\",\n \"merchantCity\": \"San Francisco\",\n \"merchantState\": \"CA\",\n \"merchantPostalCode\": \"94105\",\n \"merchantCountry\": \"US\",\n \"transactionId\": \"txn_001\",\n \"transactionDate\": \"2024-12-18T00:00:00Z\",\n \"transactionTimezone\": \"UTC\",\n \"paymentMethod\": \"card\",\n \"currency\": \"USD\",\n \"subtotal\": 2000,\n \"taxAmount\": 0,\n \"totalAmount\": 2000,\n \"items\": [\n {\n \"lineItemId\": \"li_001\",\n \"name\": \"Widget\",\n \"quantity\": 1,\n \"unitPrice\": 1000,\n \"totalPrice\": 1000\n }\n ],\n \"recipientHashedPan\": \"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8\",\n \"amount\": 1000,\n \"cardNonce\": \"cnon:card-nonce-ok\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"paymentId": "<string>",
"clientSecret": "<string>",
"orderId": "<string>",
"drpMetadata": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Path Parameters
Payment gateway provider
Available options:
stripe, square Body
application/json
Unified payment request structure for all gateways. Uses flattened receipt fields at root level (same as EncryptReceiptRequest).
ISO currency code (defaults to usd)
Hashed PAN of the recipient
Example:
"5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
Amount in cents (required for Stripe, derived from items for Square)
Show child attributes
Show child attributes
If true and items are empty, generates mock line items
Card nonce for Square payments (optional)
⌘I