Confirming Payment Intents
Once a Payment Intent is created, it must be confirmed with a payment method. This step authorizes the payment and moves the intent toward completion.
API Endpoint
POST /api/payment-intent/{intentId}/confirm
Request Parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
intentId | Path | string | The ID of the Payment Intent to confirm |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
paymentMethodId | string | Yes | The ID of the payment method to use |
contact | object | No | Updated contact information |
creditCardDetails | object | No | Credit card details if applicable |
Example Request (REST API)
Code
For credit card payments:
Code
Example Response
Code
Using the SDK
Code
For credit card payments:
Code
Payment Confirmation Flow
- Initial Confirmation: Submit the payment method ID to the API
- Status Check: The API returns the current status
- Additional Action: If authentication is required, redirect or handle accordingly
- Final Status: Wait for the final payment status
Handling Different Payment Methods
GCash and Maya Payments
Most e-wallet payments will require a redirect for authentication:
Code
Card Payments
Card payments may require 3D Secure authentication:
Code
Status Transitions After Confirmation
After confirming a Payment Intent, it may transition through:
requires_action- Additional authentication requiredprocessing- Payment is being processedsucceeded- Payment completed successfullyfailed- Payment failedcanceled- Payment was canceled
Error Handling
Common errors when confirming Payment Intents:
| Error Code | Description | Solution |
|---|---|---|
PAYMENT_METHOD_INVALID | Payment method is not valid | Verify payment method ID and status |
INSUFFICIENT_FUNDS | Insufficient funds in payment method | Ask customer to use another payment method |
3D_SECURE_REQUIRED | 3D Secure authentication required | Complete authentication flow |
INTENT_ALREADY_CONFIRMED | Intent has already been confirmed | Check intent status before confirming |
Last modified on
