curl --request POST \
--url https://api.petstoreapi.com/v1/orders/{id}/payment \
--header 'Content-Type: application/json' \
--data '
{
"amount": "49.99",
"currency": "GBP",
"source": {
"object": "card",
"name": "J. Doe",
"number": "4242424242424242",
"cvc": "123",
"expMonth": 12,
"expYear": 2025,
"addressLine1": "123 Fake Street",
"addressLine2": "4th Floor",
"addressCity": "London",
"addressCountry": "gb",
"addressPostCode": "N12 9XX"
}
}
'{
"id": "2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
"amount": "49.99",
"currency": "GBP",
"source": {
"object": "card",
"name": "J. Doe",
"number": "************4242",
"cvc": "123",
"expMonth": 12,
"expYear": 2025,
"addressCountry": "gb",
"addressPostCode": "N12 9XX"
},
"status": "succeeded"
}Pay Order
Process payment for an existing order.
Payment Workflow
Payment processing follows this workflow:
- Create Order: First create an order using
POST /orders(status:placed) - Submit Payment: Call this endpoint with payment details (card or bank account)
- Payment Processing: The payment is processed with status
processing - Payment Result:
- Success: Payment status becomes
succeeded, order status updates toapproved - Failure: Payment status becomes
failed, order remainsplacedand can be retried
- Success: Payment status becomes
- Receipt: After successful payment, retrieve the receipt from the order details
Security Note: Sensitive payment data (like CVC codes) are writeOnly and never returned in responses. Card numbers and account numbers are masked when read.
curl --request POST \
--url https://api.petstoreapi.com/v1/orders/{id}/payment \
--header 'Content-Type: application/json' \
--data '
{
"amount": "49.99",
"currency": "GBP",
"source": {
"object": "card",
"name": "J. Doe",
"number": "4242424242424242",
"cvc": "123",
"expMonth": 12,
"expYear": 2025,
"addressLine1": "123 Fake Street",
"addressLine2": "4th Floor",
"addressCity": "London",
"addressCountry": "gb",
"addressPostCode": "N12 9XX"
}
}
'{
"id": "2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
"amount": "49.99",
"currency": "GBP",
"source": {
"object": "card",
"name": "J. Doe",
"number": "************4242",
"cvc": "123",
"expMonth": 12,
"expYear": 2025,
"addressCountry": "gb",
"addressPostCode": "N12 9XX"
},
"status": "succeeded"
}Path Parameters
Unique identifier for the order
Body
Order payment information with polymorphic payment sources
Payment amount (positive decimal)
"49.99"
"100.50"
Three-letter ISO 4217 currency code (uppercase)
USD, EUR, GBP, CAD, AUD Payment source (card or bank account)
- Bank Card
- Bank Account
Show child attributes
Show child attributes
Response
Payment successful
Order payment information with polymorphic payment sources
Unique payment identifier
"2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a"
Payment amount (positive decimal)
"49.99"
"100.50"
Three-letter ISO 4217 currency code (uppercase)
USD, EUR, GBP, CAD, AUD Payment source (card or bank account)
- Bank Card
- Bank Account
Show child attributes
Show child attributes
Payment status
PENDING, PROCESSING, SUCCEEDED, FAILED, CANCELLED Payment creation timestamp