#Pickle_Rick-connect-direct
1 messages · Page 1 of 1 (latest)
Hello! When you say you're having trouble "connecting customers to my platform", do you mean connecting your connect accounts, or having customers pay?
Hi there,
thank you for your response
Yes, so I am having trouble connecting my connect accounts.
I offer an online ordering system that is embedded in restaurants (my customers) websites. I want to set it up as Direct Charges so that my customers are responsible for Stripe Fees, refunds and chargebacks etc.
Gotcha - so I assume you're working with standard accounts (which is the recommendation for direct charges). What specific issures are you running into?
Thanks, so I tried connecting a Standard account, however I got directed to Connect Setttings to allow Oauth for Standard Accounts.
What do I need to do from here?
Also where are the URI redirects suppose to take us? What URI do I put in there?
To start off, have you read through our guide on Oauth + Standard connect accounts? https://stripe.com/docs/connect/oauth-standard-accounts
Basically, the redirect_uri should be one of your own pages that you want to direct your user towards after they're done connecting.
Ok just read through that document and I'm lost as to what I need to do now. I was under the impression we would just need to send our customer a link from our Stripe to authorise the connect?
We don't want every one of our customers to come to our website to sign up and connect. We just need to tell our Stripe account to which Stripe account the money will be sent to and manage that through the Stripe platform. Is this possible? Thanks for your patience with me
Every customer/user you have that accepts payment through Stripe would need to sign up and be connected to your platform account - or does customer in this case mean someone that is paying you?
So our customer has a Stripe account, we are just trying to connect them to our platform
This is what we are looking for
So that they can receive payments from users on their site ordering food
Yes, you can send your customers a link to start the connection process, but it isn't as simple as just sending them the link and forgetting about it. The reason why the redirect to your own site is necessary is that you need to actually do some additional steps complete the connection (see https://stripe.com/docs/connect/oauth-standard-accounts#token-request).
Are you a developer? If not, this may be a better flow for you: https://stripe.com/docs/connect/dashboard/managing-individual-accounts#creating-accounts
It walks through how to do all this through the dashboard (which requires not code). You can create connect accounts through the dashboard and a one-time link will be generated that you can send to your user
Great thank you, this is exactly what I'm looking for. We want to keep this all in the dashboard. So once my customer is connected what do I do from there?
I've sent the link, and once they have filled this out, will their account automatically appear under our connected accounts?
Yup!
Groovy thanks, so can we set up the direct charge payments on the dashboard or do we need to make code changes?
I need to head out, but @gaunt wedge is hopping in to help!
No worries, thanks Karbi
@worthy tide stepping in on behalf of karbi! we can't create direct charge payments via the Dashboard so you would need to make the necessary code changes (if any).
Hi there, ok can you please direct me to the sample code that can be used to set up direct charge
here you go! https://stripe.com/docs/connect/direct-charges
Ok thanks, so once the customer is connected to our platform will their connected account ID be displayed?
yep, and there is a page in your Dashboard that will display the list of connected accounts e.g. https://dashboard.stripe.com/connect/accounts/overview
Brilliant thank you Alex. If we have multiple Stripe accounts connected how will we handle this? That page you sent has a Javascript example of only having just one.
you would inpput the connected account id in the Stripe Account parameter
that's how you differentiate between making a direct charge on connected account A versus making a direct charge on connected account B
was that what you were asking?
Great Thanks I understand the above. The confusion is here. For each connected account do we need to create and entry like this? Thanks
it depends - so the reason why that section of the doc is saying that is because for a direct charge, the charge occurs on the connected account. Since the charge occurs on the connected account, the payment method would need to exist on the connected account as well.
That section is essentially trying to say that, you would need to initialize stripe that way, so that when you create the card details, the payment method would be created on the connected account (not the platform) - https://stripe.com/docs/payments/payment-methods/connect#create-payment-method
But! there is another method - you can collect the card details on the platform and the clone the payment method to the connected account - https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
Right thanks ill check out this cloning method.
However, in the javascript setup, how would you include 3 or more connected accounts to which payment may be made?
hmmm, so you want to split a payment between 3 connected accounts?
wanted to add, i think this page would be useful for you too : https://stripe.com/docs/connect/creating-a-payments-page
No we are just wanting to have multiple accounts links to our platform receiving direct charges. Or is Direct charges only for one account?
direct charges can be used for different connected accounts. It's not limited to one connected account only. You would input the Stripe account id in the Stripe account parameter for whichever account you want the charge to occur on
👋
hey thank you
so, How do I resolve a 401 error - the attempt appears in my Stripe account but failed
I see there is a payment method missing somehow - never showed that before
could you share the request id?
hmmm, i'm not able to find the request log in your account, can you paste the full error?
sorry mate my devs computer just froze
is is restarting and will get back to you
of course all these issues happen on go live day haha
no worries
generally 401 errors are when the wrong API key is being used, trying to see if i can find further information on the request you made
{
"id": "pi_3JcLeoH3FnYor84o114JHH2c",
"object": "payment_intent",
"last_payment_error": null,
"livemode": true,
"next_action": null,
"status": "requires_payment_method",
"amount": 100,
"amount_capturable": 0,
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"charges": {
"object": "list",
"data": [
],
"has_more": false,
"total_count": 0,
"url": "/v1/charges?payment_intent=pi_3JcLeoH3FnYor84o114JHH2c"
},
"client_secret": "pi_3JcLeoH3FnYor84o114JHH2c_secret_TEVZ5AmWRG8K6IdrO17G2RAus",
"confirmation_method": "automatic",
"created": 1632279482,
"currency": "nzd",
"customer": null,
"description": null,
"invoice": null,
"metadata": {
"integration_check": "accept_a_payment"
},
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"installments": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"transfer_data": null,
"transfer_group": null
}
this is the full error
thank you mate
in Stripe = says payment method is not provided???
yeah, there wasn't a payment method provided. You need to have a payment method to charge
Sure, but how do I provide that? the code worked fine in test
lets take a step back, how did you collect the customer's card details in test?
Sorry sent the message twice, updated
ok ill send you a screen shot now
using that control - elements
alright, so after you collect the card details, you would use the ConfirmCardPayment with the PaymentIntent's client secret to confirm the PaymentIntent
but when you attempted to confirm the card payment, i assume you ran into that 401 error
which is why the PaymentIntent is still in the requires payment method state
next step here is to check your Stripe's publishable key i.e. pk_live... on your frontend, is it correct -> https://dashboard.stripe.com/apikeys
right just checked everything:
- key is correct.
- private key on our server is also correct.
I am putting the connected account id in the request options as described in the code sample
could you elaborate a bit more on I am putting the connected account id in the request options as described in the code sample?
pi_3JcLeoH3FnYor84o114JHH2c is neither a direct charge, nor a destination charge, so i'm a bit baffled as to where the connected account is coming into play here
on the client
umm, okay, i think i'm probably not understanding something
you are using both Elements and Checkout?
we create a session on the server to process the order after successful payment - is that not the session id?
we are using the Angular Stripe component ngx-stripe
elements and checkout are both used to collect card details for payment. There really isn't a need to do both.
so for example, if you already confirmCardPayment
there is no need to create another Checkout Session to further process that payment
we post the order to the server and obtain a session id from there. Then the client processes the payment within the client and after successful payment, the server is updated.
give me a second to try and wrap my mind around what you're doing - it looks to me like you're doing both Checkout and Elements, but based off your explanation, you're not
am i right to say :
- you're creating a session,
- and then getting the PaymentIntent client secret from the session,
- and using that client secret in confirmCardPayment?
this worked fine in test - just live testing is a problem
Yes correct
this is a really unusual integration method
examples show that the server needs to produce the order and then pass that to the client. as this worked fine in with test accounts, we had no reason to suspect that it would not work in the live environment
we needed to have control in the client of the payment processing as the component runs inside an iframe already
and directing back to the instance is not possible
i'll be right back, give me a while to look into the 401 error again
Ok, thank you very Alex. Really appreciate it
sorry @worthy tide i need to step out for a bit but i've explained to @storm quest about the issue you're facing and he'll help you out here once he's caught up on the conversation here
@worthy tide I am taking over for @gaunt wedge here.
Hey mate thanks
Hi WSW, switching back to test environment just works like before - no code changes
as probably mentioned by @gaunt wedge , your integration path is not a recommended integration
instead of creating Checkout Session and get the payment_intent, you should really create payment_intent directly in your server side.
and pass that intent to the client?
correct, pass the payment_intent.client_secret to the frontend
the payment has to be taken on the client
right, that is what payment_intent.client_secret is for
@worthy tide do you have an example where it happens just out of curiosity? You shared a pi_123 earlier but this one is completely unrelated to Checkout. If you could give an example Checkout Session id cs_live_123 it'd help us narrow it down.
why did this work in the test environment?
I'll switch the code back to live and get back to you
as I mentioned, it works but it is not a recommended way to do the integration. Checkout session is creating payment_intent under the hood to drive the payment and we don't expect you to deal with the payment_intent directly.
If you just need a payment to go through, there is no need to use checkout session, creating a payment_intent is sufficient.
pi_3JcMsRH3FnYor84o0ST2mm5i_secret_JkvMba43ONQ4npHKCbUoPg6y6
client secret
@worthy tide I worry you're maybe not understanding the integration you are debugging. This PaymentIntent was not created via Checkout at all. Your code in .NET explicitly went and created the PaymentIntent via the https://stripe.com/docs/api/payment_intents/create API as expected. Also it is not a direct charge flow, it's just a PI on your own Stripe account
Like here there is zero Connect impact, your code just used your own API key with no StripeAccount option and created the PI on your own account
What is a PI?
PI = PaymentIntent
my colleagues asked clearly earlier if you were creating a Checkout Session and using that Session's PaymentIntent's client_secret and you said yes, and shared code that creates a Session via https://stripe.com/docs/api/checkout/sessions/create (completely different/separate product) but I think you're likely mixing things up. That PaymentIntent at least has nothing to do with Connect, direct charges or Checkout
Have you been able to get a 401 for that new PaymentIntent?
Do you also have a URL I can look at quickly?
Is that a client URL?
Okay so something is weird, I don't see any request internally with that PaymentIntent id anywhere (Except the creation)
I mean your URL, wherever you are experiencing the 401
I'm struggling to follow the report because what you said your code does is definitely not what is happening here
Thanks! It's not working it seems to be loading indefinitely
same here
Okay I think I have a clue
401 == bad API key
looking at logs with that domain you seem to be passing an invalid API key
sorry Here
instead of passing the API key pk_live_123 you pass pk_live_123bpk_test_123
that works but I can't choose a time so I can't move to the next step
But yeah based on what I see right now in our logs with that domain, you have a bug in your config or something and you incorrectly concatenated 2 API keys by mistake
can you double check that?
You might be right, will check this now
give me a moment 🙂
it'd explain why we have no logs, we have tools that reject all requests "at the edge" when the API key is invalid
and so that API key is just broken and we never log anything we just 401
we're rebuilding and will test again
ok, payment works now - we will attempt to reconnect to the connected account for another test
@spring patrol payments are now working direct to our account. we have a connected account configured but the payment is not going to that account - how do we resolve that. Both the server and the client has the connected account id configured
@worthy tide I'm not sure what that could mean. Unfortunately most of the information you gave in this thread was incorrect earlier, since checkout seems never used, so I'm not sure how to help unblock without actionable information
But to me, right now, you are just not doing the flow documented at https://stripe.com/docs/connect/direct-charges at all and just create objects on your account which is wrong
You need to find the code you use the create the PaymentIntent and understand whether you're passing the account id or not, both server-side and client-side
I have to disconnect for the day but I do think you want to add logs to your code first and better understand how it works in Test mode and then understand why it doesn't create the PaymentIntent on the connected in Live mode (assuming it works in Test mode which it might not). Overall you really aren't passing the Stripe-Account header in your code
@storm quest on my team can help if you have more specific questions
what do I pass back to the client to complete the payment process?
you need to pass the payment_intent.client_secret to your frontend, you can follow this to see how the payment flow works.
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-create-payment-intent
the code was changed but the payment still went directly into our account and not into the connected account as expected
can you copy paste your code here? you will need to set the StripeAccount header.
and also just to confirm, are you changing your production code live and test it? Which payment_intent went directly to your account?
intent secret: pi_3JcOGDH3FnYor84o1IaYo6AX_secret_fpqfMMAgtU12gX5Q2ceY0RrtY
client code: this.stripePromise = loadStripe(environment.STRIPE_KEY, {stripeAccount: '{{acct_1G9KlQDV2WR4Y5rU}}'});
yeah, pi_3JcOGDH3FnYor84o1IaYo6AX was create in your server side, what is your server side .net code?
var intentService = new PaymentIntentService();
var createOptions = new PaymentIntentCreateOptions
{
PaymentMethodTypes = new List<string>
{
"card"
},
Amount = Convert.ToInt64(payment.Amount),
Currency = "nzd"
};
var requestOptions = new RequestOptions();
requestOptions.StripeAccount = "{{acct_1G9KlQDV2WR4Y5rU}}";
var intent = intentService.Create(createOptions, requestOptions);
return new OkObjectResult(intent.ClientSecret);
on the servver
requestOptions.StripeAccount = "{{acct_1G9KlQDV2WR4Y5rU}}"; should be requestOptions.StripeAccount = "acct_1G9KlQDV2WR4Y5rU";
are you using your live secret key for testing?
I had that code before I added the {{ and }} because it didn't work, will try again without
and yes using the live key for testing
any reason why you would use live key to do the test? I would recommend you to use test keys so that you don't have to pay real money for testing
I think the money is one thing, another thing is that you might be risking
- your account being flagged as card tester or casher
- your bank might block your card to prevent it from normal usage
the test mode will work exactly the same as live mode, there is no reason to test in live mode
last payment intent secret:
pi_3JcOZsH3FnYor84o1bWLgboC_secret_GsUHHPD1v5PvOtkEYgNeXdon8
Brackets removed, still being paid to our account not connected account
requestOptions.StripeAccount = "{{acct_1G9KlQDV2WR4Y5rU}}"; var intent = intentService.Create(createOptions, requestOptions);
can you add some log after this line and print it out and share the content of intent here?
How are you testing the integration? are you testing it locally on your .net server?
no I am not doing this locally, I am running this in Azure
yup, do you mind adding log in your .net server and print out the requestOptions and intent making sure they are passing the right parameter?
I'm not sure how to do that. Any suggestions?
you can take a look at this on how to add logging to your application https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0
I think locally you can debug your asp.net in visual studio too https://docs.microsoft.com/en-us/visualstudio/debugger/quickstart-debug-aspnet?view=vs-2019
{"id":"pi_3JcPPlDV2WR4Y5rU1ErJDvsS","object":"payment_intent","amount":100,"amount_capturable":0,"amount_received":0,"application":"ca_KGqFIbk0OAqaFaSHSIzbGitYnHXamUao","application_fee_amount":null,"canceled_at":null,"cancellation_reason":null,"capture_method":"automatic","charges":{"object":"list","data":[],"has_more":false,"url":"/v1/charges?payment_intent=pi_3JcPPlDV2WR4Y5rU1ErJDvsS"},"client_secret":"pi_3JcPPlDV2WR4Y5rU1ErJDvsS_secret_9Wa2EjwTAowbX0LmbpJM7TkEa","confirmation_method":"automatic","created":1632293925,"currency":"nzd","customer":null,"description":null,"invoice":null,"last_payment_error":null,"livemode":false,"metadata":{"integration_check":"accept_a_payment"},"next_action":null,"on_behalf_of":null,"payment_method":null,"payment_method_options":{"acss_debit":null,"afterpay_clearpay":null,"alipay":null,"bancontact":null,"boleto":null,"card":{"installments":null,"network":null,"request_three_d_secure":"automatic"},"card_present":null,"ideal":null,"oxxo":null,"p24":null,"sepa_debit":null,"sofort":null,"wechat_pay":null},"payment_method_types":["card"],"receipt_email":null,"review":null,"setup_future_usage":null,"shipping":null,"source":null,"statement_descriptor":null,"statement_descriptor_suffix":null,"status":"requires_payment_method","transfer_data":null,"transfer_group":null}
Here's the payment intent. Formatted in Json
yup, now it looks correct and the payment_intent was created to the connected account acct_1G9KlQDV2WR4Y5rU
you should pass "pi_3JcPPlDV2WR4Y5rU1ErJDvsS_secret_9Wa2EjwTAowbX0LmbpJM7TkEa", to the frontend
I just got a 404 error again
in your frontend right?
loadStripe(environment.STRIPE_KEY, {stripeAccount: '{{acct_1G9KlQDV2WR4Y5rU}}'});
can you remove {{ }}
loadStripe(environment.STRIPE_KEY, {stripeAccount: 'acct_1G9KlQDV2WR4Y5rU'});
I've done all that now getting a 404 error in the front end. This is running in test mode now
this is the 404
both keys are set to test
are you using the publishable key of your platform account? probably you can print the key out in using console.log(environment.STRIPE_KEY) making sue that's the right key
pk_test_51HZ6bjH3FnYor84o1xouBcMtCPqUgzWpfjgdzl430iLP7X0HNx1x59v0cj9QkapnNP1kv6KNB05fQnJkt7YkMV2y00mnRHC7q1
test key
async pay() {
this.busyService.busy();
console.log('getting strip key');
console.log(environment.STRIPE_KEY);
if (this.card && this.clientSecret && this.stripeCardValid) {
const card = this.card.element;
const order = this.orderService.currentOrderValue;
const billing_details = { name: order.contactName, email: order.contactEmail };
const payment_method = { card, billing_details };
console.log(this.clientSecret);
const result = await this.stripeService.confirmCardPayment(this.clientSecret, { payment_method })
.toPromise();
if (result) {
this.busyService.idle();
if (result.error) {
const outcome: IStripeResult = {
id: this.clientSecret,
resultCode: StripeResultCodeEnum.failed,
message: result.error.message
};
this.paymentCompleted(outcome);
} else {
const outcome: IStripeResult =
{
id: this.clientSecret,
resultCode: StripeResultCodeEnum.success,
message: 'payment succeeded'
};
this.paymentCompleted(outcome);
}
}
}
}
this is the pay method
this.clientSecret = this.paymentService.clientSecret;
this.stripePromise = loadStripe(environment.STRIPE_KEY, {stripeAccount: 'acct_1G9KlQDV2WR4Y5rU'});
setting the connected account
how do you initialise this.stripeService ?
CommonModule,
PaymentWidgetRoutingModule,
KendoModule,
NgxStripeModule.forRoot(environment.STRIPE_KEY)
this is where its initialized
It looks like you are using NgxStripeModule which is not a Stripe official SDK, let me check what is that
you will need to initialise it with the correct key and stripeAccount: 'acct_1G9KlQDV2WR4Y5rU
it looks like it only has the key but not the stripeAccount header
NgxStripeModule.forRoot(environment.STRIPE_KEY, {stripeAccount: 'acct_1G9KlQDV2WR4Y5rU})
Hi sorry for the delay in getting back to you
I just removed the connected account and the settings work fine so there is nothing wrong with the code
I will now add in the connected account again and retest
and we get the 404 error again.
I just removed the connected account and the settings work fine so there is nothing wrong with the code
what do you mean by that?