Creating a Checkout Session
Codeconst checkout = await saligpay.checkout.create({ externalId: "order-123", amount: 10000, // ₱100.00 in centavos description: "Premium Plan Subscription", webhookUrl: "https://yourapp.com/webhooks/saligpay", returnUrl: "https://yourapp.com/payment/success", contact: { name: "John Doe", email: "john@example.com", contact: "+639123456789", }, metadata: { orderId: "12345", userId: "user-abc", }, isThirdParty: true, }); console.log("Checkout ID:", checkout.id); console.log("Session Token:", checkout.sessionToken); console.log("Checkout URL:", checkout.checkoutUrl); console.log("Expires At:", checkout.expiresAt);
Checkout Options
Codeinterface CreateCheckoutOptions { /** Unique external reference ID (required) */ externalId: string; /** Amount in centavos (required) */ amount: number; /** Description of the payment (required) */ description: string; /** URL to receive webhook notifications (required) */ webhookUrl: string; /** URL to redirect after payment (required) */ returnUrl: string; /** Customer contact information (required) */ contact: { name: string; email: string; contact?: string; }; /** Additional metadata (optional) */ metadata?: Record<string, unknown>; /** Is third party integration (optional, default: true) */ isThirdParty?: boolean; }
Contact Information
Codeconst contact = { name: "Juan Dela Cruz", email: "juan@example.com", contact: "+639123456789", // Philippine format };
Using Access Tokens
The SDK automatically uses stored tokens, but you can provide a custom token:
Codeconst checkout = await saligpay.checkout.create( { externalId: "order-456", amount: 25000, description: "One-time purchase", webhookUrl: "https://yourapp.com/webhooks/saligpay", returnUrl: "https://yourapp.com/payment/success", contact: { name: "Jane Smith", email: "jane@example.com", }, }, "custom-access-token", // optional custom token );
Last modified on
