Skip to main content
POST
/
api
/
v1
/
receipts
/
encrypt
Encrypt receipt
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
  }
}

Body

application/json
receipt
object
required
recipientIdentifier
object
required

Response

Receipt encrypted successfully

success
boolean
Example:

true

data
object