This guide walks you through the full purchase flow: from authenticating to accessing your purchased card’s number and PIN.
Prerequisites
- Your
x-cc-app partner application ID (provided by CardCash)
- A partner account in the sandbox environment
Step 1: Create a Session
curl -X POST https://sandbox-api.cardcash.com/v3/session \
-H "x-cc-app: YOUR_APP_ID" \
-H "Content-Type: application/json"
Save the access_token from the response. Use it as Authorization: Bearer <token> on all subsequent requests.
Step 2: Log In
curl -X POST https://sandbox-api.cardcash.com/v3/customers/login \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "customer": { "email": "you@example.com", "password": "YourPassword1" } }'
Always capture the updated token from the authorization response header after login.
Step 3: Browse Merchants
curl https://sandbox-api.cardcash.com/v3/merchants/buy/bulk \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN"
This returns available merchants with discount rates and inventory counts. Pick a merchant id to view their inventory.
Step 4: View Inventory
curl https://sandbox-api.cardcash.com/v3/merchants/123/inventory/bulk \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN"
Each inventory item shows faceValue, percentOff, cost, qty, and type (physical or ecode).
Step 5: Purchase Cards
Use condensed checkout to purchase cards in a single call. Pass the cards you want directly — no cart creation needed.
curl -X POST "https://sandbox-api.cardcash.com/v3/orders?checkout=condensed" \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cards": [
{
"merchantId": 123,
"faceValue": 50,
"percentOff": 8.5,
"type": "ecode",
"quantity": 2
}
],
"payment": {
"method": "ACH",
"details": {
"id": 789
}
},
"shippingDetails": {
"firstname": "John",
"lastname": "Doe",
"street": "123 Main St",
"city": "New York",
"state": "NY",
"postcode": "10001"
},
"billingDetails": {
"firstname": "John",
"lastname": "Doe",
"street": "123 Main St",
"city": "New York",
"state": "NY",
"postcode": "10001"
}
}'
The response contains the full order object with an orderId.
Step 6: Access Your Cards
Once the order is fulfilled, cards appear in your wallet:
curl https://sandbox-api.cardcash.com/v3/wallets \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN"
Step 7: Get Card Number & PIN
curl https://sandbox-api.cardcash.com/v3/wallets/CARD_ID/secure-data \
-H "x-cc-app: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_TOKEN"
Response:
{
"number": "6006491234567890",
"pin": "1234",
"barcode": "6006491234567890"
}
Cards are accessible for 24 hours after purchase. Retrieve secure data promptly after order fulfillment.
Next Steps