PetstoreAPI Docs
Modern Petstore APIClassic Petstore APIBlog
Modern Petstore APIClassic Petstore APIBlog
  1. Payments
  • Modern Pet Store API: A New Gold Standard for OpenAPI
  • Pet
    • Get Pet
      GET
    • Update Pet
      PUT
    • Delete Pet
      DELETE
    • Create Pet
      POST
    • List Pets
      GET
    • Upload Pet Image
      POST
  • Chat
    • Create Chat Completion
      POST
  • Payments
    • Pay Order
      POST
  • Store
    • List Inventory
      GET
    • Create Order
      POST
    • Get Order
      GET
    • Delete Order
      DELETE
    • Callback Example
      POST
  • User
    • Create User
      POST
    • Update User
      PUT
    • Get User
      GET
    • Delete User
      DELETE
    • Login
      POST
    • Logout
      POST
  • Webhooks
    • Pet Adopted Event
    • New Pet Available Event
  • Schemas
    • Pet
    • PetCollection
    • User
    • OrderPayment
    • Bank Card
    • Bank Account
    • Category
    • Links
    • Order
    • ApiResponse
    • Tag
    • Error
Modern Petstore APIClassic Petstore APIBlog
Modern Petstore APIClassic Petstore APIBlog
  1. Payments

Pay Order

POST
/orders/{id}/payment
Process payment for an existing order.

Payment Workflow#

Payment processing follows this workflow:
1.
Create Order: First create an order using POST /orders (status: placed)
2.
Submit Payment: Call this endpoint with payment details (card or bank account)
3.
Payment Processing: The payment is processed with status processing
4.
Payment Result:
Success: Payment status becomes succeeded, order status updates to approved
Failure: Payment status becomes failed, order remains placed and can be retried
5.
Receipt: After successful payment, retrieve the receipt from the order details
Important: This is a synchronous payment operation. For security, sensitive payment data (like CVC codes) are writeOnly and never returned in responses. Card numbers and account numbers are masked when read.

Request

Authorization
OAuth 2.0
Authorization Code
deviceCode
Add the parameter
Authorization
to Headers
,whose value is to concatenate the Token after the Bearer.
Example:
Authorization: Bearer ********************
Authorize URL: https://auth.petstoreapi.com/authorize
Token URL: https://auth.petstoreapi.com/token
Refresh URL: https://auth.petstoreapi.com/refresh
or
JWT Bearer
Add the parameter
Authorization
to Headers
Example:
Authorization: ********************
or
or
Path Params

Body Params application/jsonRequired

Examples

Responses

🟢201
application/json
Payment successful
Headers

Body

Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST '/orders/123456/payment' \
--header 'Content-Type: application/json' \
--data-raw '{
    "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"
    }
}'
Response Response Example
Card Payment
{
    "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",
    "links": {
        "order": "https://api.example.com/orders/1725ff48-ab45-4bb5-9d02-88745177dedb/payment"
    }
}
Modified at 2025-12-17 08:25:04
Previous
Create Chat Completion
Next
List Inventory
Built with