- Upgrade Stripe JS api from v2 to v3
https://js.stripe.com/v3/
- Add Stripe Element
<div id="payment-request-button">
- Use Publishable Stripe API key
Stripe('pk_test_Ar4P8c2SvHTUYfsAF9aZuxTR')
;- Do we use Stripe Connect?
{ stripeAccount: 'CONNECTED_STRIPE_ACCOUNT_ID' }
- Register domain
- Create PaymentRequest instance
stripe.paymentRequest()
- country
- currency
- total
- label
- ammount
- Any additional options (name, email, phone used for Apple Pay to assist in preventing fraudulent payments)
- requestPayerName: true,
- requestPayerEmail: true,
- Create and "mount"/add button element
- If failed, show the standard form and hide the button
- Add a listener for the token
- When token is generated, post charges
- JSON
- When token is generated, post charges
- Determine if we need to collect shipping information
- Do we already collect shipping information for Stripe?
requestShipping: true
- Useful for updating amount if it changes
-
label: "Free shipping", detail: "Arrives in 5 to 7 days", amount: 0 }
- If shipping can be altered on the same page?
- If so, listen for 'shippingaddresschange' and update
- Send request to re-calculate shipping charges as necessary
-
- Let's use the default button
- It can be styled
- We can use our own in the future if necessary
Created
October 9, 2018 17:01
-
-
Save VizualAbstract/30c9b20e86e5dffb57373867407a2093 to your computer and use it in GitHub Desktop.
# For Apple Pay implementation (frontend)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment