#donut_code

1 messages ยท Page 1 of 1 (latest)

harsh elbowBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1423276651151753259

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

thick berry
#

hi there!

hot elbow
#

hi

#

var createSubscription = new SubscriptionCreateOptions
{
Customer = customer.Id,
Items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = price.Id } },
Metadata = createStripeSubscriptionPaymentRequest.Metadata,
Discounts = new List<SubscriptionDiscountOptions> { promotionCode == null ? new SubscriptionDiscountOptions { Coupon = coupon?.Id } : new SubscriptionDiscountOptions { PromotionCode = promotionCode?.Id } },
Currency = price.Currency
};

 if (createStripeSubscriptionPaymentRequest.PaymentOptionId == PaymentOptionConstants.PayPal)
 {
     createSubscription.Expand = new List<string> { "latest_invoice.confirmation_secret" };
     createSubscription.OffSession = true;
 }
 else if (createStripeSubscriptionPaymentRequest.PaymentOptionId == PaymentOptionConstants.ApplePay)
 {
     createSubscription.PaymentBehavior = "default_incomplete";
     createSubscription.Expand = new List<string> { "latest_invoice.payment_intent" };
     createSubscription.OffSession = true;
 }
 else
 {
     createSubscription.PaymentBehavior = "default_incomplete";
     createSubscription.Expand = new List<string> { "latest_invoice.payment_intent" };
     createSubscription.PaymentSettings = paymentSettings;
 )
thick berry
#

if you want ot start a Subscription, you don't need to create a SetupIntent.

#

directly create the Subscription, and then collect the payment details on the frontend, which by default supports Apple Pay.

#

or, for a simpler integration, directly use Checkout Session to create the Subscription for you (which also supports Apple Pay)

hot elbow
#

the frontend is using express checkout

#

and also is using stripe elements

#

but we dont use checkout sessions

thick berry
#

Yes Subscription + Express Checkout also works and does support Apple Pay.

hot elbow
#

else if (createStripeSubscriptionPaymentRequest.PaymentOptionId == PaymentOptionConstants.ApplePay)
{
createSubscription.PaymentBehavior = "default_incomplete";
createSubscription.Expand = new List<string> { "latest_invoice.payment_intent" };
createSubscription.OffSession = true;
}

are these correct for apple pay

harsh elbowBOT
night relic
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

hot elbow
#

thank you

night relic
#

wryttd?

hot elbow
#

i am trying to create stripe recurring subscriptions using apple pay as a payment method

#

i had to make that if because for paypal i had to use diff params on expand

#

and no payment behavior

#

the last else is for card payments

night relic
#

you can always expand on multiple fields

#

for example both latest_invoice.payment_intent and pending_setup_intent

#

and depending on which of these aren't null

#

you can send that to the front end and either confirmPayment or confirmSetup accordingly

hot elbow
#

what is the difference

night relic
#

it depends on whether the first invoice has a due amount or not

hot elbow
#

we charge recurring payments immediately

#

if there is no free trial

night relic
#

yes so what I'm saying works for both free trial and immediate payment subscriptions

#

but what I'm still hesitatant to understand here is why you're using latest_invoice.confirmation_secret and latest_invoice.payment_intent

#

if you're using a newer API version (basil+) then you should not use the latter

hot elbow
#

that is for paypal

#

i could find anything in the documentation

night relic
#

since there won't be any PI directly on the Invoice

#

confirmation secret should work for all payment methods

hot elbow
#

okay i'll use confirmation secret from now on. But how is that gonna affect the frontend implementation

night relic
#

you just pass it as the client_secret

hot elbow
#

they should confirm the payment in this case

#

or do smthng else

#

?

night relic
#

yes confirmPayment

hot elbow
#

here i should keep offsession true

#

right

#

else if (createStripeSubscriptionPaymentRequest.PaymentOptionId == PaymentOptionConstants.ApplePay)
{
createSubscription.PaymentBehavior = "default_incomplete";
createSubscription.Expand = new List<string> { "latest_invoice.confirmation_secret" };
createSubscription.OffSession = true;
}

night relic
#

no you never want to create your subscription off-session

hot elbow
#

why does that for paypal then

#

im so confused

night relic
#

for Paypal it's particular

#

we only allow you to use SetupIntents to create a Paypal PM that could be used for recurring Payments

hot elbow
#

okay thank you tarzan you were the only one that helped me so far

#

good job

night relic
#

this might change in the future, but for the time being, Paypal has this restriction