Skip to main content
GET
/
api
/
v1
/
payments
/
checkout
/
order
/
{id}
Get Checkout Details
curl --request GET \
  --url https://api.example.com/api/v1/payments/checkout/order/{id}/
{
  "detail": "Authentication credentials were not provided."
}

Overview

This endpoint retrieves order details and generates a Braintree client token required for payment processing. The client token is used to initialize the Braintree Drop-in UI or hosted fields on the frontend.
This endpoint returns an HTML template response containing the order details and client token. It’s designed to render a payment form in the browser.

Authentication

This endpoint requires authentication. Include a valid authentication token in the request headers.
Authorization: Bearer <your_token>

Path Parameters

id
string
required
The UUID of the order to process payment for. Must belong to the authenticated customer.

Response

Returns an HTML template response with the following context:
client_token
string
Braintree client token for initializing the payment form. This token is generated server-side and is valid for 24 hours.
order
object
Complete order details including:

Payment Flow

The typical payment flow using this endpoint:
  1. Customer creates an order through the shopping cart
  2. GET this endpoint to retrieve the client token and order details
  3. Initialize Braintree Drop-in UI with the client token
  4. Customer enters payment information in the Braintree form
  5. Submit payment using the Process Payment endpoint

Error Responses

{
  "detail": "Authentication credentials were not provided."
}
The order must belong to the authenticated customer. Attempting to access another customer’s order will result in a 404 error.

Braintree Integration

This endpoint integrates with Braintree’s payment gateway:
  • Environment: Sandbox (for testing)
  • Configuration: Set via environment variables in config/settings.py
    • BRAINTREE_MERCHANT_ID
    • BRAINTREE_PUBLIC_KEY
    • BRAINTREE_PRIVATE_KEY
The client token is generated using gateway.client_token.generate() and is required for secure client-side payment form initialization.

Code Reference

Implementation: payments/views.py:29

Build docs developers (and LLMs) love