#svetidamir

1 messages · Page 1 of 1 (latest)

wild scaffoldBOT
#

Hello! We'll be with you shortly. 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.

wraith hamlet
#

So the support from yesterday send me a guide to create a setup intent and how to add paypal as a payment method because our company is from Germany that has that option. And I have setup the user, and I setup the payment with paypal. Now I would need to make the payment on the item, and subscribe the user to it.

hexed swift
#

How do you integration with Stripe for subscription? Checkout Session or direct Subscription API?

wraith hamlet
#

Will get back to you soon, just to check.

#

Okay so I use the stripe lib and I tried creating a subscription like this :

// Create a Subscription const subscription = await stripe.subscriptions.create({ customer: customer.id, items: [{ price: priceId }], });

hexed swift
#

I see! This is direct Subscription API integration. You can set the saved payment method under default_payment_method for a subscription: https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method

In fact, you don't need to use Setup Intent first. You can follow this guide to create a subscription with PayPal directly: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements

Create and manage subscriptions to accept recurring payments.

wraith hamlet
#

Okay, so I need to create the subscription like this:

const subscription = await stripe.subscriptions.create({ customer: customerId, items: [{ price: priceId, }], payment_behavior: 'default_incomplete', payment_settings: { save_default_payment_method: 'on_subscription' }, expand: ['latest_invoice.payment_intent'], });

To set it to incomplete and then when I create this, try to make the payment with paypal and listen to the webhook did the user pay?

hexed swift
#

Yes, correct!

wraith hamlet
#

Okay I will try to make that and if I get stuck I will write in this chat. Is that okay? Or should I open a new ticket?