Overview
Cheqpay’s Hosted Payment Page (HPP) allows you to accept payments with minimal integration effort. Create a payment link with a single API call, then redirect customers to Cheqpay’s hosted checkout page where they can complete their payment securely.Integration Flow
The Hosted Payment Page integration involves three main steps:- Create Payment Link - Your backend creates a payment link via API
- Customer Checkout - Customer is redirected to Cheqpay’s hosted payment page
- Payment Completion - Customer is redirected back to your site with payment status
Before You Start
Prerequisites
- Cheqpay merchant account with API credentials
- Backend server to create payment links
- Redirect URL endpoint to handle payment completion
Authentication
All API requests require authentication using your API key:Step 1: Create Payment Link
Create a payment link by making a POST request to the payment links endpoint. For complete API documentation, see the Create Payment Link API Reference.Endpoint
Request Example
Response
Upon successful creation, you’ll receive a payment link object with aurl field that you’ll use to redirect the customer. See the Create Payment Link API Reference for the complete response schema.
Use the
url field from the response to redirect your customer to the payment page.Step 2: Redirect Customer to Payment Page
Once you receive the payment link URL, redirect your customer to it:Step 3: Handle Payment Completion
After the customer completes payment (or cancels), Cheqpay redirects them back to yourredirectUrl with query parameters:
cp_status- Payment status (successorfailed)cp_invoice_id- Invoice ID for retrieving payment details
Example Redirect URL
Handle the Redirect
Step 4: Retrieve Invoice Details
After payment completion, retrieve the invoice details to confirm the payment and get order information. For complete API documentation, see the Get Invoice API Reference.Endpoint
Best Practices
Security
Security
- Always validate the
cp_statusandcp_invoice_idparameters on your server - Never trust client-side status - always verify by fetching invoice details
- Use HTTPS for all redirect URLs
- Store API keys securely on your backend, never expose them to the client
Error Handling
Error Handling
- Handle network errors when creating payment links
- Implement retry logic for failed API calls
- Show user-friendly error messages
- Log errors for debugging
User Experience
User Experience
- Show a loading state while creating the payment link
- Provide clear instructions during redirect
- Handle payment completion gracefully
- Send confirmation emails after successful payment
Testing
Use the staging environment for testing:Next Steps
- Learn about Payment Orders for direct API integration
- Understand 3D Secure authentication flows
- Review Error Handling best practices
- Check the Link Product API Reference for complete API documentation