#uchi-subscriptins-referral

1 messages · Page 1 of 1 (latest)

toxic night
#

Hello! Whether you use "Elements" or a "client_secret" doesn't really change anything to the flow so I'm not sure I follow what part is confusing you

little tinsel
#

Ok, so this is the flow I have:

  • user enters checkout page
  • as soon as they enter, a stripe customer account is created
  • Once that happens, it creates a subscription with the status "incomplete"
  • at this point, I have access to the payment intent of that "incomplete" via a client_secret
  • Once the user enter their payment details, I use ElementsPayment to handle the card details.

On the function, I am using stripe.confirmCardPayment, which all it needs is the client_secret and the card details, and the payment is processed. At this point, I am confused on how to implement transfers

#

Should it be something done on a webhook?

toxic night
little tinsel
#

Ah awesome. So, anything that has to do with transfers or commissions, I can manage it on webhooks then, correct? Basically, once I get the succeeded event, right?

toxic night
#

yes

#

you can also set transfer_data on the PaymentIntent so that it's done automatically

little tinsel
#

You mean within the client_secret?

toxic night
#

not really

little tinsel
#

Hmmm could you give me a quick sample?

toxic night
#

I'm sorry I'm a bit lost I don't understnad what you don't understand

#

Is there a reason you use separate charges and transfers?

#

you mentioned a "checkout page" but seems you don't use Checkout. You also mentioned subscriptions but don't use our Subscription API
Sorry trying to grasp what you need help with

little tinsel
#

Ok, let me see if I can explain it better. The checkout page is a custom page I created. What I am using in there that's from Stripe, is ElementsPayment, which creates the UI for the credit card form. I am creating the subscription using stripe.subscriptions.create, and adding expand to get the latest_invoice.payment_intent, which brings the client_secret. Then, I use that client secret on ElementsPayment and submit the payment form using stripe.confirmCardPayment

#

At that point, everything works as expected. The payment goes through, and the subscription becomes active. My roadblock is on how to add a transfer to that flow

toxic night
#

okay so you do use our Subscriptions API and you're making an exception on the first payment to transfer funds to the referral person

#

so yeah in that case a webhook is the right approach

little tinsel
#

Alrighty, got it. I will try that. Is there any specific data I can send to the webhook? Like userID for example?

#

I will need something like that so that I can specify who is receiving the commission

#

Since they will be using a Connect account

toxic night
#

usually you'd map that in your own database

#

or set as metadata on the Subscription for example

little tinsel
#

Ah ok, got it. I will experiment with it then. Thank you!