Skip to main content

Get Started in 3 Steps

This quickstart guide will walk you through creating your first payment transaction with 88Pay. By the end, you’ll have successfully processed a test payment.
This guide uses the Sandbox environment for testing. No real money will be transferred.

Prerequisites

Before you begin, make sure you have:
Sign up at dash.88pay.io/signup if you haven’t already.
Upload and get your documents approved in the Account Details section.
Obtain your API Key and Merchant ID from the Settings → API Credentials section.

Step 1: Generate Authentication Token

First, you need to generate a short-lived access token that will authorize your API requests.
curl -X POST "https://api-sandbox.88pay.io/api/auth/token" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-merchant-id: YOUR_MERCHANT_ID"

Response

{
  "status": "Success",
  "code": 200,
  "message": "Token generated successfully",
  "data": {
    "access_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expires_in": 60,
    "session_id": "sess_53a2cfc4-441e-4554-b560-4e008784d98e"
  }
}
The token expires in 60 seconds. Generate a new token for each operation or when the current one expires.

Step 2: Create a Payment

Now let’s create a card payment transaction. Save the access_token and session_id from Step 1.
curl -X POST "https://api-sandbox.88pay.io/api/transactions/charges" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-session-id: YOUR_SESSION_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "flow": "PAYIN",
    "method_code": "CARDS",
    "method_category": "CARD",
    "amount": 50000,
    "country": "COL",
    "currency": "COP",
    "description": "Test Purchase #001",
    "customer_id": "customer_12345",
    "notification_url": "https://yoursite.com/webhook",
    "return_url": "https://yoursite.com/thank-you"
  }'

Response

{
  "status": "Success",
  "code": 200,
  "message": "Method processed",
  "data": {
    "urlCheckout": "https://link.88pay.io/GSW4WAR",
    "reference": "IP9BD7CJES6",
    "customer_id": "customer_12345",
    "currency": "COP",
    "amount": 50000
  }
}
The urlCheckout is where you should redirect your customer to complete the payment.

Step 3: Redirect Customer & Handle Webhook

Redirect Customer to Checkout

Redirect your customer to the urlCheckout URL received in the response:
// Redirect customer to payment page
window.location.href = data.urlCheckout;

Receive Webhook Notification

After the customer completes (or cancels) the payment, 88Pay will send a POST request to your notification_url:
{
  "transaction_date": "2025-01-17 14:30:45",
  "transaction_status": "COMPLETED",
  "transaction_id": "sess_4e91a5c1-b7f2-4c64-91b1-3d204a5738b4",
  "transaction_amount": "50000",
  "transaction_payment_method": "CREDIT_CARD",
  "transaction_country": "COL",
  "transaction_currency": "COP",
  "transaction_reference": "IP9BD7CJES6",
  "transaction_customer_id": "customer_12345"
}
Your webhook endpoint must respond with 200 OK to confirm receipt.

Testing the Integration

Test Card Numbers (Sandbox Only)

Use these test cards in the Sandbox environment:
Card NumberStatusDescription
4111111111111111✅ ApprovedSuccessful payment
4000000000000002❌ DeclinedCard declined
4000000000000069⏳ PendingPayment pending
Expiry Date: Any future date
CVV: Any 3 digits

Complete Example

Here’s a complete integration example:
async function processPayment() {
  try {
    // Step 1: Generate Token
    const tokenResponse = await fetch('https://api-sandbox.88pay.io/api/auth/token', {
      method: 'POST',
      headers: {
        'x-api-key': 'YOUR_API_KEY',
        'x-merchant-id': 'YOUR_MERCHANT_ID'
      }
    });
    
    const { data: { access_token, session_id } } = await tokenResponse.json();
    
    // Step 2: Create Payment
    const paymentResponse = await fetch('https://api-sandbox.88pay.io/api/transactions/charges', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${access_token}`,
        'x-session-id': session_id,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        flow: "PAYIN",
        method_code: "CARDS",
        method_category: "CARD",
        amount: 50000,
        country: "COL",
        currency: "COP",
        description: "Test Purchase #001",
        customer_id: "customer_12345",
        notification_url: "https://yoursite.com/webhook",
        return_url: "https://yoursite.com/thank-you"
      })
    });
    
    const payment = await paymentResponse.json();
    
    // Step 3: Redirect to checkout
    window.location.href = payment.data.urlCheckout;
    
  } catch (error) {
    console.error('Payment error:', error);
  }
}

Next Steps

Congratulations! 🎉 You’ve successfully created your first payment with 88Pay.

Need Help?

Join our Community

Get help from our developer community