AliPay for FOSSBilling
Alipay Open Platform Computer Website Payment adapter (RSA2) for FOSSBilling.
This is a community, unofficial extension. It is not affiliated with Alipay or FOSSBilling. Test thoroughly in a non-production environment before accepting real payments.
Tested on
Verified on FOSSBilling 0.8.7 with a China personal Alipay “Computer Website Payment” application:
- Payment can be initiated after configuring App ID, application private key, and Alipay public key
- Customers can redirect to the Alipay checkout page and complete payment
- After a valid async notification (signature verified), the invoice is marked paid and the order is activated
Important limitations
- Currency: CNY only
Domestic personal/merchant Computer Website Payment typically settles in Chinese Yuan (CNY) only. Set product and invoice currency toCNY. Do not price in USD or other currencies — this adapter does not perform currency conversion. - You need an Alipay Open Platform app with Computer Website Payment enabled
- Signature method must be RSA2
- Per-transaction and daily limits follow your app’s quota on the Open Platform (apps without a submitted business license may have low limits, e.g. max ¥50 per payment and ¥1000 per day)
Installation
- Save the adapter file as:
library/Payment/Adapter/AliPay.php
2. In the admin area: System → Payment gateways → New → select AliPay and enable it.
3. Configure:
- App ID
- Application private key (RSA2 PKCS8; remove header/footer and all line breaks before pasting)
- Alipay public key (the Alipay public key from the Open Platform signing settings — not the application public key)
4. On the Open Platform: enable Computer Website Payment, upload the application public key that matches your private key, and set the sign type to RSA2.
5. notify_url is generated by FOSSBilling automatically; you do not need to set it manually.
## Security notes
- Never commit the application private key to Git, chat apps, or public pages
- Before going live, run a small real payment end-to-end: pay → return → check invoice/transaction status → confirm the order activates
- Periodically reconcile FOSSBilling transactions with Alipay merchant orders
## License
MIT License.
## Disclaimer
This software is provided “as is”, without warranty of any kind. The author is not liable for financial loss, missed payments, accounting errors, or service interruption arising from its use. Always test carefully before accepting real payments.