curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/receipts/encrypt \
--header 'Content-Type: application/json' \
--data '
{
"receipt": {
"version": "1.0",
"receiptId": "550e8400-e29b-41d4-a716-446655440003",
"merchant": {
"merchantId": "550e8400-e29b-41d4-a716-446655440004",
"name": "Store Name",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US"
},
"taxId": "12-3456789",
"logoUrl": "https://example.com/logo.png",
"contactPhone": "+1-555-1234",
"contactEmail": "[email protected]"
},
"transaction": {
"transactionId": "550e8400-e29b-41d4-a716-446655440005",
"datetime": "2025-12-15T12:30:00Z",
"paymentMethod": "card",
"timezone": "America/New_York",
"cardDetails": {
"last4": "4242",
"brand": "visa",
"expiryMonth": 12,
"expiryYear": 2026
},
"authorizationCode": "AUTH123456"
},
"items": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440006",
"name": "Widget Pro",
"quantity": 2,
"unitPrice": 1999,
"totalPrice": 3998,
"sku": "SKU-001",
"description": "Premium widget with advanced features",
"category": "Electronics",
"discounts": [
{
"name": "Holiday Sale",
"type": "percentage",
"value": 10,
"amount": 400
}
],
"taxes": [
{
"name": "Sales Tax",
"rate": 0.08,
"amount": 288
}
]
}
],
"summary": {
"subtotal": 3998,
"totalTax": 320,
"totalDiscount": 400,
"total": 4018,
"currency": "USD",
"itemCount": 1,
"tipAmount": 100
},
"createdAt": "2025-12-15T12:35:00Z",
"notes": "Thank you for shopping!",
"returnPolicy": "30-day return policy",
"loyaltyInfo": {
"programName": "Rewards Program",
"pointsEarned": 40,
"pointsBalance": 1240,
"memberNumber": "MEMBER123456"
},
"metadata": {}
},
"recipientIdentifier": {
"type": "email",
"value": "[email protected]"
}
}
'{
"success": true,
"data": {
"version": "1.0",
"receiptId": "550e8400-e29b-41d4-a716-446655440003",
"keyId": "550e8400-e29b-41d4-a716-446655440000",
"keyBundle": {
"encryptedAesKey": "encrypted_aes_key_base64...",
"keyId": "550e8400-e29b-41d4-a716-446655440000",
"algorithm": "RSA-OAEP-256"
},
"ciphertext": "encrypted_receipt_ciphertext_base64...",
"iv": "initialization_vector_base64...",
"authTag": "auth_tag_base64...",
"merchantId": "550e8400-e29b-41d4-a716-446655440004",
"transactionId": "550e8400-e29b-41d4-a716-446655440005",
"createdAt": "2025-12-15T12:35:00Z",
"expiresAt": "2025-12-16T12:35:00Z",
"isEscrowed": false,
"escrowKeyId": null
}
}Encrypt a digital receipt for a specific recipient using hybrid encryption:
If the recipient is not onboarded, the receipt will be encrypted with
the escrow key instead (indicated by isEscrowed: true in the response).
curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/receipts/encrypt \
--header 'Content-Type: application/json' \
--data '
{
"receipt": {
"version": "1.0",
"receiptId": "550e8400-e29b-41d4-a716-446655440003",
"merchant": {
"merchantId": "550e8400-e29b-41d4-a716-446655440004",
"name": "Store Name",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US"
},
"taxId": "12-3456789",
"logoUrl": "https://example.com/logo.png",
"contactPhone": "+1-555-1234",
"contactEmail": "[email protected]"
},
"transaction": {
"transactionId": "550e8400-e29b-41d4-a716-446655440005",
"datetime": "2025-12-15T12:30:00Z",
"paymentMethod": "card",
"timezone": "America/New_York",
"cardDetails": {
"last4": "4242",
"brand": "visa",
"expiryMonth": 12,
"expiryYear": 2026
},
"authorizationCode": "AUTH123456"
},
"items": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440006",
"name": "Widget Pro",
"quantity": 2,
"unitPrice": 1999,
"totalPrice": 3998,
"sku": "SKU-001",
"description": "Premium widget with advanced features",
"category": "Electronics",
"discounts": [
{
"name": "Holiday Sale",
"type": "percentage",
"value": 10,
"amount": 400
}
],
"taxes": [
{
"name": "Sales Tax",
"rate": 0.08,
"amount": 288
}
]
}
],
"summary": {
"subtotal": 3998,
"totalTax": 320,
"totalDiscount": 400,
"total": 4018,
"currency": "USD",
"itemCount": 1,
"tipAmount": 100
},
"createdAt": "2025-12-15T12:35:00Z",
"notes": "Thank you for shopping!",
"returnPolicy": "30-day return policy",
"loyaltyInfo": {
"programName": "Rewards Program",
"pointsEarned": 40,
"pointsBalance": 1240,
"memberNumber": "MEMBER123456"
},
"metadata": {}
},
"recipientIdentifier": {
"type": "email",
"value": "[email protected]"
}
}
'{
"success": true,
"data": {
"version": "1.0",
"receiptId": "550e8400-e29b-41d4-a716-446655440003",
"keyId": "550e8400-e29b-41d4-a716-446655440000",
"keyBundle": {
"encryptedAesKey": "encrypted_aes_key_base64...",
"keyId": "550e8400-e29b-41d4-a716-446655440000",
"algorithm": "RSA-OAEP-256"
},
"ciphertext": "encrypted_receipt_ciphertext_base64...",
"iv": "initialization_vector_base64...",
"authTag": "auth_tag_base64...",
"merchantId": "550e8400-e29b-41d4-a716-446655440004",
"transactionId": "550e8400-e29b-41d4-a716-446655440005",
"createdAt": "2025-12-15T12:35:00Z",
"expiresAt": "2025-12-16T12:35:00Z",
"isEscrowed": false,
"escrowKeyId": null
}
}Show child attributes
Receipt schema version
"1.0"
"550e8400-e29b-41d4-a716-446655440003"
Show child attributes
"550e8400-e29b-41d4-a716-446655440004"
"Store Name"
"12-3456789"
"https://example.com/logo.png"
"+1-555-1234"
Show child attributes
"550e8400-e29b-41d4-a716-446655440005"
"2025-12-15T12:30:00Z"
card, cash, mobile_wallet, bank_transfer, other "card"
"America/New_York"
Show child attributes
Last 4 digits of the card
"4242"
visa, mastercard, amex, discover, other "visa"
1 <= x <= 1212
2026
"AUTH123456"
Show child attributes
"550e8400-e29b-41d4-a716-446655440006"
"Widget Pro"
2
Price in smallest currency unit (cents)
1999
Total price in smallest currency unit (cents)
3998
"SKU-001"
"Premium widget with advanced features"
"Electronics"
Show child attributes
"Holiday Sale"
percentage, fixed "percentage"
Percentage (0-100) or fixed amount in cents
10
Discount amount in cents
400
Show child attributes
Subtotal in cents
3998
Total tax in cents
320
Total discount in cents
400
Grand total in cents
4018
ISO 4217 currency code
"USD"
1
Tip amount in cents
100
"2025-12-15T12:35:00Z"
"Thank you for shopping!"
"30-day return policy"
Show child attributes
email, phone, national_id, bank_account "email"
Receipt encrypted successfully
true
Show child attributes
"1.0"
"550e8400-e29b-41d4-a716-446655440003"
"550e8400-e29b-41d4-a716-446655440000"
Show child attributes
Base64-encoded AES-GCM encrypted receipt
"encrypted_receipt_ciphertext_base64..."
Base64-encoded initialization vector
"initialization_vector_base64..."
Base64-encoded GCM authentication tag
"auth_tag_base64..."
"550e8400-e29b-41d4-a716-446655440004"
"550e8400-e29b-41d4-a716-446655440005"
"2025-12-15T12:35:00Z"
"2025-12-16T12:35:00Z"
True if encrypted with escrow key (user not onboarded)
false
Escrow key ID if isEscrowed is true
null