Sandbox Setup
Set up your 2C2P sandbox environment with demo credentials, test cards, and a working API call in minutes.
Set up your sandbox environment and make your first test API call
Sandbox vs. Production
2C2P provides a sandbox environment that mirrors production behavior without processing real payments. Use it throughout development and testing.
| Sandbox | Production | |
|---|---|---|
| Base URL | https://sandbox-pgw.2c2p.com | https://pgw.2c2p.com |
| Credentials | Demo Merchant ID + Secret Key | Issued by 2C2P |
| Real charges | No — all transactions are simulated | Yes — real money is processed |
| Payment methods | All enabled payment methods | All enabled payment methods |
Authentication
2C2P API requests and responses use JSON Web Tokens (JWT) signed with HMAC SHA-256 using your Secret Key.
Every API call follows this pattern:
- Build a JSON payload with your request data
- Sign it as a JWT using your Secret Key
- Send the signed token in the
payloadfield of your POST request - Decode the JWT in the response using the same Secret Key
For full details on generating and decoding JWT tokens, refer to JSON Web Tokens (JWT).
Make Your First API Call
Request a Payment Token to verify your sandbox setup is working. Payment Token API is the first step in every payment flow.
1. Prepare the request payload
{
"merchantID": "JT01",
"invoiceNo": "1523953661",
"description": "item 1",
"amount": 1000.00,
"currencyCode": "SGD"
}2. Sign the payload as a JWT
Sign the JSON above using HMAC SHA-256 with the secret Key . This produces a JWT string. Refer to Generate JWT Token for code examples in multiple languages.
3. Send the request
curl --location --request POST 'https://sandbox-pgw.2c2p.com/payment/4.3/paymentToken' \
--header 'Content-Type: application/json' \
--data-raw '{
"payload": "<your-signed-jwt-token>"
}'4. Verify the response
Decode the JWT in the response using the same Secret Key. A successful response looks like this:
{
"webPaymentUrl": "https://sandbox-pgw-ui.2c2p.com/payment/4.3/#/token/...",
"paymentToken": "kSAops9Zwhos8hSTSeLTUcCr...",
"respCode": "0000",
"respDesc": "Success"
}respCode0000 confirms your sandbox setup is working correctly.webPaymentUrlis the hosted payment page URL — open it in a browser to see the checkout UI.paymentTokenis used for Direct API integration to submit payment details programmatically.
If
respCodeis not0000, the request failed. Refer to Payment Response Codes for error details.
Test Cards
Use these test card numbers when completing payments on the sandbox. For any card, use a future expiry date and the CVV listed.
| Card Scheme | Card Number | CVV | OTP |
|---|---|---|---|
| Visa | 4111111111111111 | 123 | 123456 |
| Mastercard | 5555555555554444 | 123 | 123456 |
| Amex | 378282246310005 | 1234 | — |
| JCB | 3562808775869340 | 495 | 123456 |
| UnionPay | 6250947000000014 | 123 | 123456 |
For country-specific test cards including installment payment plan (IPP) cards, refer to:
Go Live Checklist
When sandbox testing is complete, follow these steps to switch to production:
- Get production credentials - Contact 2C2P to receive your production Merchant ID and Secret Key.
- Update the base URL - Replace
https://sandbox-pgw.2c2p.comwithhttps://pgw.2c2p.comin all API calls. - Replace credentials - Swap the sandbox Merchant ID and Secret Key for your production credentials.
- Configure webhook endpoints Optional - Ensure your backend return URL points to your production server to receive payment notifications.
- Run a live test - Make a small real transaction to confirm end-to-end connectivity.
Next Steps
Choose your integration method and build your first payment flow:
Updated about 8 hours ago
