### Shopify Plugin Setup for EasyKash Payments Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-shopify-plugin This guide details the steps to configure the EasyKash Gateway plugin on a Shopify website. It covers app creation, API configuration, obtaining access tokens, and setting up EasyKash account integration, including the callback URL. ```Shopify https://back.easykash.net/api/integrations/callback/shopify ``` -------------------------------- ### Enable EasyKash Gateway in WordPress WooCommerce Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-wordpress-woocommerce-plugin This guide explains how to enable and configure the EasyKash Gateway plugin within a WordPress WooCommerce setup. It covers installation, enabling the gateway, setting payment labels and descriptions, and configuring API keys and callback URLs. ```PHP 1. As a prerequisite, make sure you have WooCommerce installed 2. Get the Easykash Gateway Plugin and install it on your WordPress website (Manually Upload the plugin from Plugins > Add New > Upload Plugin) 3. On the side menu, go to WooCommerce Settings > Payments > Easykash Gateway 4. Enable Easykash Gateway 5. Add title for payment label 6. Add description for payment description 7. Add live private key for payment api (Get it from your EasyKash Account > Integration Settings) 8. Copy the callback URL, go to your EasyKash account > Integration Settings, paste and save it in the Callback URL field. ``` -------------------------------- ### Inquire Payment Response Example Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/inquire-a-payment Provides an example of a successful response when inquiring about a payment transaction. It includes details such as payment method, amount, buyer information, and transaction status. ```JSON { "PaymentMethod": "Cash Through Fawry", "Amount": "10.05", "BuyerName": "Omar Ayman", "BuyerEmail": "omar@ayman.com", "BuyerMobile": "01011111111111", "status": "PAID", "voucher": "32423432", "easykashRef": "1206102054" } ``` -------------------------------- ### Create Cash Payment API Response Example Source: https://easykash.gitbook.io/easykash-apis-documentation/cash-api/create-a-payment Provides an example of a successful response when creating a cash payment. It includes details like the voucher code, expiry date, payment provider, and EasyKash reference number. ```json { //voucher: The payment code the buyer will use to pay at a POS (Fawry or Aman, depending on what the business has configured with Easykash). //in case of cash out, voucher will return mobile number "voucher": "9100596414", //expiryDate: The expiry date/time of the payment. "expiryDate": "9/08/2021, 10:23:35 PM", //provider: Business provider. Fawry or Aman. "provider": "Fawry", //easykashRef: The reference number of the payment. "easykashRef": "900397518" } ``` -------------------------------- ### Create Cash Payment API Request Body Example Source: https://easykash.gitbook.io/easykash-apis-documentation/cash-api/create-a-payment An example of the request body required to create a cash payment. It demonstrates the necessary fields like payer email, mobile, name, amount, expiry duration, API key, voucher data, and payment type. ```json { "payerEmail": "mostafa@gmail.com", "payerMobile": "01011111157", "payerName": "Mostafa", "amount": 10, "expiryDuration": 48, "apiKey": "1si4c9", "VoucherData": "description", "type": "in" } ``` -------------------------------- ### Callback Service API Notification Source: https://easykash.gitbook.io/easykash-apis-documentation/callback-service This is an example of the API notification received by your service after a successful payment. It includes details about the transaction, buyer information, and a signature hash for verification. ```JSON { "ProductCode":"CHQ4668", "PaymentMethod":"Cash Through Fawry/Cash Through Aman/Credit & Debit Card/Mobile Wallet/Meeza/Qassatly/Cash Api", "ProductType":"Physical Product/Invoice/Event/Quick Payment/Quick Cash/Subscription/Custom Payment/Quick Qassatly/Fawry Payout/Booking", "Amount":"50.5", "BuyerEmail":"johndoe@domain.com", "BuyerMobile":"01111111111", "BuyerName":"John Doe", "Timestamp":"1626166791", "status":"PAID", "voucher":"32423432", "easykashRef":"3242143421", "VoucherData":"test", "customerReference":"1232", "signatureHash":"0bd9ce502950ffa358314c170dace42e7ba3e0c776f5a32eb15c3d496bc9c294835036dd90d4f287233b800c9bde2f6591b6b8a1f675b6bfe64fd799da29d1d0" } ``` -------------------------------- ### EasyKash Pay API Response Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/pay-api Successful response from the EasyKash Pay API, containing a redirect URL to the payment gateway. The user must be redirected to this link to proceed with the payment. ```json { "redirectUrl": "https://easykash.net/DirectPayV1/QBE6685" } ``` -------------------------------- ### EasyKash Redirect URL Parameters Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/pay-api Query parameters appended to the redirect URL after a payment attempt. These parameters provide the status of the payment, provider reference number, customer reference, and a voucher number if applicable (e.g., for Aman or Fawry). ```url https://www.google.com/?status=NEW&providerRefNum=2206290593680&customerReference=721227 ``` -------------------------------- ### Cash API: Create Payment Source: https://easykash.gitbook.io/easykash-apis-documentation/cash-api Enables businesses to create cash payments through the EasyKash API. Supports two types: Quick Cash (type: in) and Cash Out (type: out). Requires an API Key for authentication. ```request_body { "type": "in" or "out", "amount": "100.00", "currency": "USD", "description": "Payment for order #123" } ``` -------------------------------- ### EasyKash Pay API Request Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/pay-api API to create a direct pay link for EasyKash. Requires an authorization header with your API key and a request body containing payment details such as amount, currency, payment options, buyer information, and customer reference. ```json { "amount": 10, "currency": "EGP", "paymentOptions": [ 2, 3, 4, 5, 6 ], "cashExpiry": 3, "name": "Omar Ayman", "email": "omar@ayman.com", "mobile": "01011111111111", "redirectUrl": "https://www.google.com/", "customerReference": 111 } ``` -------------------------------- ### Inquire Payment Request Body Structure Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/inquire-a-payment Defines the structure of the request body for the 'Inquire a payment' API. It specifies the customerReference as a required string representing the product's reference number. ```JSON { "PaymentMethod":"Cash Through Fawry/Cash Through Aman/Credit & Debit Card/Mobile Wallet/Meeza/Qassatly/Cash Api", "Amount":"50.5", "BuyerEmail":"johndoe@domain.com", "BuyerMobile":"01111111111", "BuyerName":"John Doe", "status":"DELIVERED/EXPIRED/FAILED/NEW/PAID/REFUNDED/CANCELED", "voucher":"32423432", (in case of cash) "easykashRef":"3242143421", } ``` -------------------------------- ### Callback Service: Payment Verification Source: https://easykash.gitbook.io/easykash-apis-documentation/cash-api The Callback service allows EasyKash to notify your system about the status of pending payments. This is crucial for confirming that payments have been successfully processed. ```callback_url_example https://your-website.com/easykash-callback ``` -------------------------------- ### Verify EasyKash Callback Response (PHP) Source: https://easykash.gitbook.io/easykash-apis-documentation/callback-response-verification Verifies the authenticity and integrity of data received from EasyKash callbacks using HMAC SHA-512 authentication. It requires the payload data and a secret key to calculate and compare the signature hash. ```php function verifyCallback($payload, $secretKey ) { // Extract data from the payload $productCode = $payload->ProductCode; $amount = $payload->Amount; $productType = $payload->ProductType; $paymentMethod = $payload->PaymentMethod; $status = $payload->status; $easykashRef = $payload->easykashRef; $customerReference = $payload->customerReference; $signatureHash = $payload->signatureHash; // Prepare data for verification $dataToSecure = [ $productCode, $amount, $productType, $paymentMethod, $status, $easykashRef, $customerReference, ]; $dataStr = implode('', $dataToSecure); // Generate HMAC SHA-512 hash for verification $calculatedSignature = hash_hmac('sha512', $dataStr, $secretKey); // Check if the calculated hash matches the received signatureHash return $calculatedSignature === $signatureHash; } ``` -------------------------------- ### Verify EasyKash Callback Response (JavaScript) Source: https://easykash.gitbook.io/easykash-apis-documentation/callback-response-verification Verifies the authenticity and integrity of data received from EasyKash callbacks using HMAC SHA-512 authentication. It requires the payload data and a secret key to calculate and compare the signature hash. ```javascript function verifyCallback(payload, secretKey) { // Extract data from the payload const { ProductCode, Amount, ProductType, PaymentMethod, status, easykashRef, customerReference, signatureHash, } = payload; // Prepare data for verification constdataToSocure= [ ProductCode, Amount, ProductType, PaymentMethod, status, easykashRef, customerReference, ]; constdataStr=dataToSocure.join(''); // Generate HMAC SHA-512 hash for verification constcalculatedSignature= crypto .createHmac('sha512', secretKey) .update(dataStr) .digest('hex'); // Check if the calculated hash matches the received signatureHash return calculatedSignature === signatureHash; } ``` -------------------------------- ### Inquire Payment Transaction Source: https://easykash.gitbook.io/easykash-apis-documentation/direct-payment-hosted/inquire-a-payment Inquires about a specific transaction on EasyKash using the Cash API. Requires an authorization header with the Cash API key and a request body containing the customer's reference number. ```HTTP POST https://back.easykash.net/api/cash-api/inquire Headers: authorization: Cash API key Request Body: { "customerReference": "111" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.