项目作者: yifeiwu
项目描述 :
accepting alipay via stripe rails app
高级语言: Ruby
项目地址: git://github.com/yifeiwu/rails-stripe-alipay.git
Stripe Alipay Demo App
Overview
This project is a demonstration of how to use Stripe to accept Ant Financial’s Alipay payments. Unlike credit card payments where the the only action needed is input of the credit card info, Alipay has a few extra steps. Here’s an overview of the workflow:
- Customer performs an action that initiates the transaction, e.g. checkout.
- On the backend, we create a source object using the Stripe API that contains our credentials and info on the transaction e.g. amount.
- The API returns a source object which includes a redirect URL. The redirect URL contains a Alipay generated QR code which has the details of this transaction.
- The customer scans the QR code using their Alipay mobile app. This app tells Alipay that the customer is authorizing a payment from their account to our account.
- The source now becomes chargeable. We can setup a webhook (from Stripe dashboard) to ping our server with this notification.
- When the source is chargeable, we make a charge request using the Stripe API.
- Voila, the money is now in your account!
Getting this Demo to work
- Get your Stripe API keys and set them in your ENV variables see the stripe initializer file for details.
- I have this demo running as a heroku project. This is necessary to get the webhook to hit your server.
- Setup your Stripe webhook to point to the
actual_charge
endpoint e.g. http://heroku.herokuapp.com/actual_charge
- Navigate to
create_source
to initiate the transaction