This guide provides essential information for integrating the YowPay Checkout system into an e-commerce platform. It covers backend and frontend integration points, focusing on generating payment links and handling payment responses.
- Backend Logic: Contains PHP scripts for generating payment links and interacting with the YowPay API.
- Frontend Pages: Includes user-facing pages for initiating transactions and handling success or cancellation responses.
generateInvoice.php
: Main script for generating a YowPay payment link.yowpayApi.php
: Wrapper class for YowPay API interactions, including signature generation.
index.php
: Entry point for users to initiate a purchase.success.html
andcancel.html
: Pages displayed to users upon successful or cancelled transactions, respectively.
The generateInvoice.php
script is responsible for creating a payment link. It requires transaction details such as amount, currency, order ID, and language. This script uses the YowPayApi class to generate a secure signature and constructs the payment URL with necessary query parameters.
The yowpayApi.php
file contains the YowPayApi class, which facilitates secure communication with YowPay's API. It includes methods for signature generation and making API calls.
- Configure API Credentials: Replace
'APP_TOKEN'
and'APP_SECRET_KEY'
ingenerateInvoice.php
with your actual YowPay credentials. Setup a shop : https://yowpay.com/account/commerce - Set Up Frontend: Customize
index.php
to match your product or service offerings. - Handle Responses: Ensure
success.html
andcancel.html
are set up to provide appropriate feedback to your customers. Linking callback/cancel/webhook : https://yowpay.com/account/commerce/detail - Handling Customer Info: TD - Shortcut solution is using the Reference field to save string user/purchase information.
The provided code snippets include placeholders for sensitive data (APP_TOKEN, APP_SECRET_KEY). In a production environment, it's crucial to secure these credentials properly. Avoid hardcoding them directly in your codebase. Consider using environment variables or secure configuration files.