#johan
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
to purchase a one time product and a subscription
do you mean at the same time?
no my bad I mean separate
we want to allow customers to purchase one time products and also subscriptions using apple pay if they have any payment methods stored there
for one-time products it's https://stripe.com/docs/apple-pay?platform=react-native
the only difference for subscriptions is that instead of creating a PaymentIntent you would use the subscription's latest_invoice.payment_intent's client_secret
if the subscription has a 100% coupon or a free trial (e.g. the first invoice is 0) instead you need to use the pending_setup_intent on the subscription
not sure what you mean in the second step? do I need to create the subscription first before attempting to charge them?
yes this is what we recommend
and where do I get the client_secret? does it come from, latest_invoice.payment_intent.client_secret?
what if the payment doesn't go through? we need to cancel the membership I assume, is there any documentation on how to properly handle this?
you can read more about it here https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
yes exactly
we actually got it working with creating a setupIntent in the server and using the clientSecret from the response to confirmApplePayment(clientSecret) and it works fine as well
is this method fine too?
the reason why we don't recommend this is because it's confusing for customers
when you use SetupIntents the PaymentSheet will display 0 instead of the subscription's price
yes you are right, we get that it displays 0 I assume is to confirm the payment method storage for future usage
and when it requires customer authentication it re asks them again to confirm
please do not close the thread im just double checking the above in case I have more questions
so say for example, if the payment doesn't go throw for x reason e.g insufficient funds, then we'll need to cancel the membership in here https://stripe.com/docs/apple-pay?platform=react-native#client-side on line 38: if (confirmError) {} right?
Hi there ๐ jumping in as my teammate needed to step away. Yes that is correct, unless you wanted to allow your customer to try again with a different Payment Method, then you could reuse the existing Subscription I believe.
perfect I understand. thanks so much for the help
Any time!
what happens if we set 'Recurring' in paymentType, inside cartItems when presentingApplePay, say if we create a subscription will it charge the customer twice?
from what you mentioned here that is very similar to one time payments, do I need to set paymentType: 'Immediate' then?
I'm not sure off-hand, my hunch is it is primarily used to adjust the UI that is displayed to the customer, but I'm not certain on that.
Let me see what I can find.
perfect thanks a lot, I just wanted to make sure before setting it to "Recurring" in case side effects happen
otherwise I can just leave it as "Immediate" all the time even if it's for subscriptions
I do see that recurring seems to only be supported on iOS 15+, and that for earlier versions that option falls back to immediate:
https://stripe.dev/stripe-react-native/api-reference/modules/ApplePay.html#RecurringCartSummaryItem
Documentation for @stripe/stripe-react-native
perfect thank you I will set it to immediate just in case
I need to step away soon and am closing this thread. If there is anything else that my teammates can assist with, then please let them know in #dev-help. ๐