#garethdmm - Connect + Subscriptions

1 messages ยท Page 1 of 1 (latest)

celest jungle
#

Hello, happy to help. What are your questions?

half frost
#

Background: we're a platform, we're trying to allow our customers to set up subscriptions with their end-users. We're using connect and subscriptions to do this. One of our requirements is that we'd like the stripe fees to be paid by our platform, so we're using destination charges for the subscriptions. Problem is, this makes the subscriptions appear to come from us (the platform), and not our customer.

#

I found that for normal invoices, this can be solve by setting the on_behalf_of field in the invoice object. This field normally isn't available for subscriptions, but we've been whitelisted into the stripe beta that allows this.

#

However, now I'm getting confusing errors when I set the on_behalf_of field for subscriptions with destination charges

#

e.g. "> (node:37395) UnhandledPromiseRejectionWarning: Error: When using any payment method types other than card and card_present, you cannot specify an on_behalf_of value, settlement of charges must be performed in the country of the platform account. Settling charges in the country of the destination account is ONLY supported with card and card_present types."

#

Sorry for the wall of text!

celest jungle
#

Gotcha, what call are you getting that error on?

half frost
#

stripe.subscriptions.create()

celest jungle
#

Do you have a request ID from a time you got that error (req_123)?

half frost
#

I'm sure I can find one

#

What's the easiest way to get a request id?

#

Maybe this? req_QXkLWuEhGAsCqN

celest jungle
#

Looks good to me thank you.

#

And to be clear, this exact code was working before?

#

It might be because the payment types are being automatically generated by Stripe and they specify payment types other than card and card present.

half frost
celest jungle
#

Gotcha, thank you. Just making sure we didn't break working code out from under you

half frost
celest jungle
#

Interesting. Checking where that error may be coming from

half frost
#

This part of the error seems like its telling us something but I don't understand it:

"settlement of charges must be performed in the country of the platform account. Settling charges in the country of the destination account is ONLY supported with card and card_present types."

#

We're only trying to charge US customers. Maybe there's a legal reason why this is being disabled

celest jungle
#

I am unsure, still looking in to this. It looks like the platform and connected account are in the samr country right?

half frost
#

Yeah they should be the same country

#

We don't have any users outside the US

#

I know, this is a tricky one eh?

celest jungle
#

Yeah, because of this whitelisted feature, it may be better to write in to our support to get routed to the team that deals with it. I am going to reach out to some colleagues to see if they have ideas on how to set this up properly

half frost
#

Ok, I'll reach out to our support person as well. Please let me know if any of your colleagues have thoughts too!

#

It's also possible there's different way to achieve the same goal: subscription/recurring invoices for a connected account where the stripe fees post to the platform account.

celest jungle
#

I am unsure if we have something for that for subscriptions at the moment but will check with my colleagues as well

#

So one thing we noticed is that the customer that the subscription was created for has a default payment method that is ACH. Can you retry this on a customer with a card?

#

Or by specifying the default payment method directly on the subscription?

half frost
#

Sure

#

Is there a way to change default payment method through the dashboard, or do I do that through another API call?

celest jungle
#

Yes, you can change it on the Customer's page in the dashboard

#

It actually might be easiest to just set payment_method: "pm_card_visa" on your Subscription creation call to quickly test this

half frost
#

is pm_card_visa a testing constant?

#

I think I'm not getting this right

celest jungle
#

Yes, it is a test constant that you should be able to just pass in. If that isn't working, it may be best to try changing it manually in the dashboard

#

Unfortunately this feature can be touchy. If this test doesn't help, I think it would be best to write in to our support with this question https://support.stripe.com/?contact=true so that they can direct you to the team that is in charge of this feature, they will have better context on how to use it than I do.

half frost
#

Sorry for the delay, I figured out how to change it in the dashboard

#

At least we got a new error this time! > (node:40479) UnhandledPromiseRejectionWarning: ReferenceError: sent_invoice is not defined

#

Very interesting though, this response in my console returns an error, but shows up as a 200 in the dashboard: req_12V3FTIiqzZNqg

celest jungle
#

Interesting, do you have a stack trace for that error? Is it happening somewhere in the Stripe library or your code?

half frost
#

Definitely in the stripe library

#

Oh wait, nope, I lied

#

Oh wow this actually is successfully creating a subscription now, that's progress!

#

Ok, so what we learned is on_behalf_of is touchy with subscriptions in general, and specifically will fail if the customer's default payment method is set to ACH (or potentially, anything other than card)

#

Ok, I'm going to keep playing with this to understand it better, but thanks so much for helping me over that hurdle ๐Ÿ˜€

celest jungle
#

Great to hear!

#

Yeah, unfortunately this can be pretty touchy. Glad we didn't need to reach out to support on this one but that often can be a good place to start when working with this behavior in future.