Creating Payment Intents
Creating a Payment Intent is the first step in the payment process. This involves initializing the payment with details about the amount to collect, the customer, and other relevant information.
API Endpoint
POST /api/payment-intent
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount in centavos (e.g., P100.00 = 10000) |
description | string | Yes | Description of the payment |
externalId | string | Yes | Unique external reference ID |
contact | object | Yes | Customer contact information |
contact.name | string | Yes | Customer's full name |
contact.email | string | Yes | Customer's email address |
contact.phone | string | No | Customer's phone number |
metadata | object | No | Additional metadata |
returnUrl | string | No | URL to redirect after payment |
webhookUrl | string | No | URL for webhook notifications |
Example Request (REST API)
Code
Example Response
Code
Using the SDK
Code
Payment Methods Available
After creating a Payment Intent, the response will include an array of available payment methods. Common payment methods include:
gcash- GCash wallet paymentsgrab_pay- GrabPay wallet paymentscard- Credit and debit card paymentspaymaya- Maya wallet payments
Security Considerations
When creating Payment Intents:
- Always validate the amount before sending to the API
- Sanitize and validate all user-provided input
- Use HTTPS for all API communications
- Store the
externalIdsecurely to prevent duplicate charges - Implement proper error handling for declined payments
Error Handling
Common errors when creating Payment Intents:
| Error Code | Description | Solution |
|---|---|---|
VALIDATION_ERROR | Invalid input data | Check required fields and formats |
AMOUNT_TOO_SMALL | Amount below minimum threshold | Increase amount to meet minimum requirements |
INVALID_CONTACT_INFO | Invalid contact information | Verify contact details format |
AUTHENTICATION_ERROR | Invalid API credentials | Check your API keys and authentication |
Last modified on
