=== CamPay EDD Payment Gateway === Contributors: gabinho12 Tags: easy digital downloads, mobile money, orange money, mtn, payment gateway Requires at least: 6.7 Tested up to: 7.1 Requires PHP: 8.0 Stable tag: 1.6 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html Sell with Easy Digital Downloads and get paid by MTN Mobile Money, Orange Money and debit or credit cards through CamPay. == Description == CamPay is a Cameroonian fintech service of TAKWID GROUP, running since January 2021. It lets businesses and organisations collect and send money online, mainly through MTN Mobile Money and Orange Money. This plugin adds CamPay as a payment gateway to [Easy Digital Downloads](https://wordpress.org/plugins/easy-digital-downloads/) (free or Pro). = How customers pay = * **Mobile Money**: at checkout the customer chooses CamPay, enters their 9-digit MTN or Orange number, clicks Purchase and approves the payment on their phone with their PIN. No prompt? They can dial *126# (MTN) or #150*50# (Orange) to approve pending payments. * **Debit or credit card**: the customer is sent to a secure CamPay page to enter their card details, then comes back to your store. Cards are only offered when you enable them and card payments are activated on your CamPay account. = Features = * MTN Mobile Money and Orange Money, with phone number validation * Debit and credit card payments on the secure CamPay page * Uses the EDD test mode to work with the CamPay demo environment * Store currency in FCFA (XAF), or in US dollars or euros converted to XAF with your own rates * Webhook: payments confirmed after the customer left the page are still recorded * Every card return and webhook is checked with the CamPay signature and verified with the CamPay API before an order is completed * The CamPay reference and the operator (MTN / Orange) reference are saved on every order; the operator reference is used as the transaction ID * When something goes wrong, the real CamPay error is saved as a note on the order and in the EDD payment error logs = Requirements = * Easy Digital Downloads 3.0 or newer * A CamPay account and app: sign up on [campay.net](https://www.campay.net/) (or [demo.campay.net](https://demo.campay.net/) to test) * For card payments: card payments activated on your CamPay account, and your store on a public domain (CamPay does not accept return addresses on localhost) == Installation == 1. In your WordPress dashboard go to Plugins > Add New, search for "CamPay EDD Payment Gateway", then click Install and Activate. Easy Digital Downloads must be installed and active. 2. Go to Downloads > Settings > Payments and enable "CamPay Payment Gateway". 3. Open the "CamPay" section of the Payments settings. 4. Enter the App Username and App Password of your CamPay app (found in your CamPay dashboard). Use the demo app credentials while EDD test mode is on, and the live ones otherwise. 5. In your CamPay dashboard, set the Webhook URL of your app to the "Webhook URL" shown in the settings, then copy the app's Webhook Key into "Webhook Key". 6. Optional: tick "Card payments" to let customers pay by card. 7. Optional: if your store currency is USD or EUR, set how many XAF one dollar or one euro is worth. 8. Save your settings. == Frequently Asked Questions == = Where do I find my App Username, App Password and Webhook Key? = Log in to your CamPay dashboard, open your app and look under the app keys. The demo site (demo.campay.net) and the live site (campay.net) have different apps and credentials. = How do I test without real money? = Turn on the test mode in Downloads > Settings > Payments and use the credentials of your CamPay demo app. The plugin then uses demo.campay.net. = Why don't customers see the card option? = Check that "Card payments" is ticked and that card payments are activated on your CamPay account (contact CamPay if not). The plugin checks your account and only shows cards when they are available. = Card payments fail with "Invalid redirect_url" = CamPay refuses return addresses on localhost or private domains. Card payments need your store on a public domain. Mobile Money works everywhere. = Which currencies are supported? = CamPay charges in FCFA (XAF). With a store currency in USD or EUR, set the matching conversion rate; the amount is converted and rounded up to the next franc. Without a rate, payments in that currency are refused. = Where can I see what went wrong with an order? = Open the order in Downloads > Orders: the notes show the CamPay error returned by the API. The details (HTTP status, response and request, without your password) are also in Downloads > Tools > Logs, under payment errors. Only shop managers and administrators can see them. == External services == This plugin connects to the CamPay API (https://www.campay.net, or https://demo.campay.net in test mode) to process payments. It is required for the gateway to work. * **Authentication**: when a payment is processed or card availability is checked, your App Username and App Password are sent to get an access token. * **Card availability**: when the checkout form is displayed with card payments enabled, the plugin asks CamPay whether cards are activated on your account (the answer is cached for up to an hour). * **Mobile Money payment**: when a customer places an order, the amount in XAF, the customer's phone number, a description (site address and purchase key) and a unique reference are sent. The plugin then checks the payment status until it is confirmed. * **Card payment**: when a customer chooses to pay by card, the amount in XAF, a description, a unique reference, the customer's first name, last name and email, and the return address on your store are sent to create the payment page. The customer enters card details on the CamPay page, not on your site. * **Verification**: when the customer comes back from the card page or CamPay calls the webhook, the transaction is fetched from CamPay to confirm it. CamPay is provided by TAKWID GROUP: [terms and conditions](https://www.campay.net/static/docs/CamPay_Terms_and_Conditions.pdf), [privacy policy](https://www.campay.net/static/docs/CamPay_Privacy_Policy.pdf). API documentation: [CamPay API](https://documenter.getpostman.com/view/2391374/T1LV8PVA). == Changelog == = 1.6 - 2026-09-15 = * New: debit and credit card payments are back, on the secure CamPay page, when activated on the CamPay account * New: webhook, secured with the CamPay signature (JWT signed with the app Webhook Key); late Mobile Money confirmations are recorded * New: real CamPay API errors are logged in Downloads > Tools > Logs and noted on the order * New: webhook calls, card returns and transactions are logged in Downloads > Tools > Debug Log * Security: card returns and webhooks are always verified with the CamPay API (reference and amount) * The operator reference is saved on every order and used as the transaction ID * Converted USD/EUR amounts are rounded up to the next XAF * Timed out Mobile Money orders stay pending so a late confirmation can complete them * New: phone number field with the +237 prefix * Fix: the gateway styles are only loaded on the checkout, so they no longer restyle other CamPay plugins * Fix: waiting for a Mobile Money confirmation no longer blocks the customer's other requests * Compatibility with Easy Digital Downloads 3.x, WordPress 6.7+ and PHP 8 * Gateway settings moved to their own "CamPay" section in Downloads > Settings > Payments * Plugin loads on plugins_loaded, works with EDD Pro and network activated installs * Failed payments are marked as failed, successful payments store the CamPay reference as transaction ID * Server side validation of the phone number * XAF amounts are displayed without decimals * Decimal prices and conversion rates are no longer truncated before conversion * Transaction status is checked every 5 seconds instead of continuously = 1.5 - 2024-11-19 = * Card payments removed = 1.4 - 2024-04-16 = * Fixed card payments issues * Added failure_redirect_url for card payments = 1.3 - 2023-04-11 = * Support for WordPress 6.2 = 1.2 - 2022-09-19 = * Added credit card payments = 1.1 - 2021-10-28 = * Added USD and EUR support with manual conversion rates * Simpler error messages = 1.0 - 2021-05-25 = * First release == Upgrade Notice == = 1.6 = Requires Easy Digital Downloads 3.0 or greater and PHP 8.0 or greater. Adds card payments and the webhook. After updating, set the Webhook URL and Webhook Key of your CamPay app in Downloads > Settings > Payments > CamPay.