Direct API Integration
Full control over your payment flows with PayOS APIs
Overview
Direct API Integration with PayOS allows merchants to manage their own checkout screens and directly interact with PayOS APIs for payments. This approach offers full control over the user experience but requires the merchant to adhere to strict PCI-DSS compliance if sensitive card data is handled.
PCI-DSS Compliance Required
When using Direct API Integration, if your checkout process collects sensitive card details, you must be PCI-DSS certified. PayOS takes no responsibility for PCI violations if merchants improperly handle sensitive data. It is strongly recommended to outsource card data handling to our Secure Fields or Hosted Checkout to minimize compliance burdens.
How It Works
-
Initiate a Payment Session: Create a payment initiation request to receive available payment methods from PayOS.
-
Present Payment Options: Display the payment methods returned from PayOS on your custom checkout page.
-
Capture and Process Payment Details: For card payments, you will need to capture card details and submit them securely to PayOS.
-
Receive Payment Status Updates: Use webhooks to get real-time status updates for payments (e.g., authorized, declined).
Example: Payment Initiation Request
Initiating a payment with PayOS involves sending a request to the API to start a payment session. This session will provide you with the available payment methods that you can present to your customers.
Sample Response:
Handling Card Payments
If the customer selects a card payment, the merchant must collect the card details securely. This requires PCI compliance to ensure the safety of sensitive card information.
If you collect card data directly, PCI certification is mandatory.
Example of a card payment submission:
Webhooks for Payment Status
PayOS will notify merchants via webhooks about the status of transactions. Make sure your server is set up to receive and handle these notifications.
Sample webhook payload:
Best Practices
- Secure Payment Handling: Use tokenization where possible to avoid direct exposure to sensitive data.
- Monitor API Usage: Ensure you are using the API efficiently to avoid rate limits.
- Webhooks: Use webhooks for real-time updates on payment statuses.
- Error Handling: Implement retry mechanisms for failed payments based on PayOS’s error codes.