PIX Checkout Testing and Validation
🔧 Getting Started
Prerequisites
- Valid Astrapay account
- API credentials (client ID and secret)
Authentication
All API requests require OAuth 2.0 authentication using a Bearer token obtained here.
Base URLs
- Sandbox:
https://api-sandbox.astrapay.com.br/v1 - Production:
https://api.astrapay.com.br/v1
Common Headers
All API requests must include the following headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
x-transaction-id: 550e8400-e29b-41d4-a716-446655440000
API Endpoints
1. Create PIX Checkout
POST /pix-checkout
Creates a new PIX checkout with multiple payments.
Request Body Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"debitAccount": {
"agency": "1234",
"account": "987654321",
"accountType": "CHECKING",
"accountDigit": "5"
},
"payments": [
{
"paymentId": "PAY_001",
"pixKey": {
"type": "CPF",
"value": "12345678901"
},
"amount": 100.00,
"beneficiaryName": "João Silva",
"description": "Test payment 1",
"userReference": "EMP_001"
},
{
"paymentId": "PAY_002",
"pixKey": {
"type": "EMAIL",
"value": "[email protected]"
},
"amount": 200.00,
"beneficiaryName": "Maria Santos",
"description": "Test payment 2",
"userReference": "EMP_002"
}
],
"userReference": "TEST_CHECKOUT_JANUARY_2025"
}
Response Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"status": "CREATED",
"totalPayments": 2,
"totalAmount": 300.00,
"createdAt": "2025-01-15T10:30:00Z",
"xTransactionId": "550e8400-e29b-41d4-a716-446655440000"
}
2. Get PIX Checkout Details
GET /pix-checkout/{checkoutId}
Retrieves detailed information about a specific PIX checkout.
Response Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"status": "PROCESSING",
"debitAccount": {
"agency": "1234",
"account": "987654321",
"accountType": "CHECKING",
"accountDigit": "5"
},
"totalPayments": 2,
"totalAmount": 300.00,
"processedPayments": 1,
"processedAmount": 100.00,
"createdAt": "2025-01-15T10:30:00Z",
"releasedAt": "2025-01-15T10:35:00Z",
"userReference": "TEST_CHECKOUT_JANUARY_2025"
}
3. Get PIX Checkout Payments
GET /pix-checkout/{checkoutId}/payments
Retrieves all payments within a specific PIX checkout.
Response Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"payments": [
{
"paymentId": "PAY_001",
"pixKey": {
"type": "CPF",
"value": "12345678901"
},
"amount": 100.00,
"beneficiaryName": "João Silva",
"description": "Test payment 1",
"status": "COMPLETED",
"processedAt": "2025-01-15T10:40:00Z",
"endToEndId": "E12345678202501151234567890",
"userReference": "EMP_001"
},
{
"paymentId": "PAY_002",
"pixKey": {
"type": "EMAIL",
"value": "[email protected]"
},
"amount": 200.00,
"beneficiaryName": "Maria Santos",
"description": "Test payment 2",
"status": "PROCESSING",
"userReference": "EMP_002"
}
],
"totalPayments": 2
}
4. Release PIX Checkout
PUT /pix-checkout/{checkoutId}/release
Authorizes the processing of all payments within a PIX checkout.
Response Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"status": "PROCESSING",
"releasedAt": "2025-01-15T10:35:00Z",
"xTransactionId": "550e8400-e29b-41d4-a716-446655440000"
}
5. Cancel PIX Checkout
PUT /pix-checkout/{checkoutId}/cancel
Cancels a PIX checkout and all its payments.
Response Example:
{
"checkoutId": "TEST_CHECKOUT_001",
"status": "CANCELLED",
"cancelledAt": "2025-01-15T10:40:00Z",
"xTransactionId": "550e8400-e29b-41d4-a716-446655440000"
}
