2Creating a Checkout Session
Once authenticated, you can create a checkout session for your customer. This generates a unique payment URL that you can redirect your customer to.
Checkout Session Endpoint
| Endpoint | Method | Description | Authentication |
|---|---|---|---|
| /api/checkout | POST | Create a new checkout session | Bearer token required |
Checkout Session Request
The checkout session request requires details about the payment, customer, and callback URLs:
RequestPOST /api/checkout
// Get access token first (see Authentication section)
const accessToken = await getValidAccessToken();
// Create checkout session request
const response = await axios.post(
'https://apisaligpay.microsource.com.ph/api/checkout',
{
amount: 2500, // $25.00
currency: "USD",
description: "Premium Plan - Monthly",
externalId: "order_ref_12345",
customerInfo: {
email: "customer@example.com",
name: "John Doe"
},
successUrl: "https://your-store.com/success",
cancelUrl: "https://your-store.com/cancel",
metadata: {
productId: "premium_monthly"
}
},
{
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${accessToken}`
},
}
);
// Sample successful response
{
"success": true,
"data": {
"sessionId": "cs_12345abcdef",
"checkoutUrl": "https://checkout.saligpay.com/cs_12345abcdef",
"expiresAt": "2023-05-24T15:30:45Z",
"status": "PENDING"
}
}Request Parameters Explained
Required Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | number | Yes | Amount in cents (e.g., 2500 for $25.00) |
| currency | string | Yes | Three-letter ISO currency code (e.g., USD) |
| externalId | string | Yes | Your unique identifier for this transaction |
| successUrl | string | Yes | URL to redirect after successful payment |
| cancelUrl | string | Yes | URL to redirect if customer cancels payment |
Optional Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
| description | string | No | Brief description of the payment |
| customerInfo | object | No | Customer details like email and name |
| expiresIn | number | No | Session expiration in minutes (default: 30) |
| metadata | object | No | Additional data to store with the transaction |