#Wasabi - UPE + Tax

1 messages ยท Page 1 of 1 (latest)

elfin rampart
#

Hi ๐Ÿ‘‹

astral jasper
#

@elfin rampart hiii

#

For context, because our user uses a third party, they need a way to collect a payment method and customer billing information before creating a subscription. Below is their proof of concept using SetupIntent to collect a payment method, grab billing information to create a tax rate API, and finally create a subscription for their subscribers. Would you please confirm if the flow is efficient and if alternative recommendations or considerations you have for the users? In addition, can you please help with the users' questions below?

#

Proof of concept

  1. FE calls a backend service endpoint to get a client-secret to initialize payment elements
  2. The service endpoint will
    2a. create a setup intent, not attached to any customer neither a payment method is specified at this time ( I did not specify any payment method types, so this defaults to card)
    2b. The client secret of the setup intent is sent back to the web front end
  3. Web frontend initializes the payment elements with this client secret
  4. Customer enters their credit card details and submits; at this time, the web FE client code would call the stripe JS function confirmSetup
  5. The Web Frontend will then extract the payment method id from the setup intent and submit to a backend services endpoint
  6. The services endpoint will
    6a. create a customer with the invoice_settings.default_payment_method set as the payment method id received from the FE, other customer data will also be set at this point
    6b. extract the billing_details.address from the payment method and calculate a tax rate by calling vertex
    6c. create a tax rate object on stripe
    6d. create a subscription for the customer, with payment_behavior as default_incomplete, the default_payment_method, the tax rate, and the price id of the membership product
    6e. return the client secret from the latest_invoice.payment_intent to the web front end along with payment method id, payment details, total etc.
  7. The web front end will display the total including taxes and a confirmation button - TBC for UX if we need to do this via a customer action or if this would happen in the background without an explicit button and review page.
  8. On clicking the confirm button, the web front end will call the stripe js function confirmPayment with the payment method id sent back from services, this completes the subscription.
  9. The Web front end calls a services endpoint to activate the subscription in our database.
#

For step 8, we are returning the client secret from the step 6.e to the client, however the confirmPayment stripe js element takes an elements object and I did not see a way to attach a payment method to it, however, you can attach the paymentMethod and secret,

if you call confirmCardPayment or any of the other specific payment method specific methods, is there a way we can call confirmPayment with an already created payment method?
Is there an alternative for steps 7-8 so that we can submit the payment with the payment method that is already created?

#

Please let me know if you want this in a word doc instead?

elfin rampart
#

There is a lot here but let's start at the top. The purpose of the SetupIntent is to assign a payment method with a customer. This handles assigning a payment method with a customer automatically once a payment method is confirmed. So in the first server side step I would advise creating the Setup intent with a customer assigned to it.

#

As for the question, confirmPayment is payment element specific. This means using confirmPayment will always require the card information being input into the payment element. confirmCardPayment, on the other hand, will allow you to confirm the payment method using just the client secret after the subscription is created.

#

If you could do me a favor and edit your response above to add in numbers (the Google Doc requires login) so I can better understand which line numbers you are referring to I can try to answer your last question.

astral jasper
elfin rampart
#

For step 7 I think an explicit button is actually what you would want to provide. Depending on the payment method, there may be additional verification steps required. This would ensure that your customer is present and can respond.

#

For step 8 I think we discussed that using confirmCardPayment is the function that will allow to simply use a client secret.

astral jasper
#

@elfin rampart thanks so much for looking into this and respond so quickly! To confirm, all esle the flow is optimal given the product in scope?

#

Do you foresee any tradeoffs or risks with the flow post your recs?

elfin rampart
#

I think it makes sense. I can understand why it may seem less than optimal but this is probably the best approach when using both payment elements and a 3rd party tax solution.

astral jasper
#

Awesome, thank you for confirming! ๐Ÿ™‚