stripe-archive / stripe-payments-demo

Sample store accepting universal payments on the web with Stripe Elements, Payment Request, Apple Pay, Google Pay, Microsoft Pay, and the PaymentIntents API. 💳🌍✨
https://stripe-payments-demo.appspot.com
MIT License
1.47k stars 547 forks source link

complete demo code for alipay #139

Closed hkbluesky closed 4 years ago

hkbluesky commented 4 years ago

Hi, could you provide the complete demo code for alipay including the front-end and back-end? This demo does not provide the complete demo code for alipay. Thanks

thorsten-stripe commented 4 years ago

Hey @hkbluesky, sorry that you weren't able to find the relevant pieces for Alipay, they are included:

  1. https://stripe.com/docs/sources/alipay#create-source ➡️ https://github.com/stripe/stripe-payments-demo/blob/master/public/javascripts/payments.js#L363
  2. https://stripe.com/docs/sources/alipay#customer-action ➡️ https://github.com/stripe/stripe-payments-demo/blob/master/public/javascripts/payments.js#L443-L447
  3. https://stripe.com/docs/sources/alipay#charge-request ➡️ https://github.com/stripe/stripe-payments-demo/blob/master/server/node/routes.js#L133-L151
  4. https://stripe.com/docs/sources/alipay#charge-confirmation ➡️ https://github.com/stripe/stripe-payments-demo/blob/master/server/node/routes.js#L113-L131

For further help with your integration, please ask questions via our email support or the technical chat on IRC: https://support.stripe.com/

hkbluesky commented 4 years ago

Thanks. I examined the code before I asked. But I think the demo does not work for alipay. I set sourceData per your document.
https://github.com/stripe/stripe-payments-demo/blob/master/public/javascripts/payments.js#L319-L334 const sourceData = { type: 'alipay', amount: 1, currency: 'usd', redirect: { return_url: 'https://shop.example.com/crtA6B28E1', }, } However, in https://github.com/stripe/stripe-payments-demo/blob/master/public/javascripts/payments.js#L414, the source has a null value. Could you check? Thanks

thorsten-stripe commented 4 years ago

It works fine for me both locally and at https://stripe-payments-demo.appspot.com/: image

Sorry, but this isn't a support channel, please use the official support channels mentioned above to get help with your integration.