Has anyone here successfully implemented Apple Pay for subscriptions in-app while integrating with Stripe as their payment processor?
How do I create a subscription with Apple Pay as a payment method?
Currently:
I ask the user for their preferred payment method using STPPaymentOptionsViewController .
If the user selects Apple Pay, I proceed to present the Apple Pay model using STPApplePayContext.presentApplePay .
Once the user confirms payment, using STPApplePayContextDelegate , I use applePayContext:didCreatePaymentMethod:paymentInformation:completion to extract paymentMethod.stripeId.
With the stripeId info, I attempt to create a subscription object by calling my server to create the subscription with stripe given then customer, items and defaultpaymentmethod (using stripe id).
The error I get is the following: "The customer does not have a payment method with the ID XXXXXXXXXXXXX. The payment method must be attached to the customer.",
Questions:
In step 3, the function requires me to create a paymentIntent to create a one-off payment which makes me assume that this is not the correct approach as I would not be able to simply create the subscription without also charging the user a one-time payment. Am I taking the right approach? If not, can you please respond in detail what the right approach is?
If it is possible to create a subscription object using the above approach, how can I ignore the creation of a payment intent to circumvent creating a one-time payment?
If it is not possible to create a subscription with Apple Pay as payment method, how can I remove Apple Pay as a payment option from the STPPaymentOptionsViewController given that I need it to be present (Apply Pay) when I present the STPPaymentOptionsViewController else where in the app?