#Shivam Kumar

1 messages · Page 1 of 1 (latest)

final thunderBOT
uneven basalt
#

👋 happy to help

prisma dew
uneven basalt
#

the part of the doc I sent you concerns connect

#

You can collect customer bank accounts on the platform account and clone ACH Direct debit payment methods. Cloning these methods allows you to save customer bank accounts for later use on connected accounts. When you clone ACH Direct Debit payment methods, Stripe duplicates the mandate authorization to the connected account, but we don’t send any new mandate confirmation emails.

prisma dew
#

I read docs propely and i implement this code but i got error
if(auth()->user()->stripe_customer_id){

This code for getting client secret from serve side
if(!auth()->user()->stripe_customer_id){
$customer = $stripe->customers->create([
'name' => auth()->user()->full_name,
'email' => auth()->user()->email
],
['stripe_account' => auth()->user()->stripe_connect_account_id]
);
$user->stripe_customer_id = $customer->id;
$user->save();
}
$setup_intent = $stripe->setupIntents->create(
[
'customer' => auth()->user()->stripe_customer_id,
'payment_method_types' => ['us_bank_account'],
'payment_method_options' => [
'us_bank_account' => [
'verification_method' => 'microdeposits',
],
],
],
['stripe_account' => auth()->user()->stripe_connect_account_id]
);
$clientSecret = $setup_intent->client_secret;

    return view('account.renter.bank.modals.add_bank', compact('request','stripe_publish_key','clientSecret'));
#

and this is my fronend code
var stripe = Stripe('{{ $stripe_publish_key }}', {
stripeAccount: '{{ auth()->user()->stripe_connect_account_id }}',
});
$(document).ready(function(){
$("#add-bank").click(function(){
$('#empty_modal').modal('hide');
var clientSecret = '';
var setupIntent = {};
$.ajax({
url: '{{url('account/renter/bank/add_stripe_bank')}}',
type: 'post',
headers: {
'X-CSRF-TOKEN': csrf_token,
},
dataType: 'json',

                success: function(response){
                    var setupIntent = response.setupIntent;
                    var bankSetup = stripe.collectBankAccountForSetup({
                        clientSecret : setupIntent.client_secret,
                        params: {
                            payment_method_type: 'us_bank_account',
                            payment_method_data: {
                                billing_details: {name: '{{ auth()->user()->first_name.' '.auth()->user()->last_name }}', email: '{{ auth()->user()->email }}'},
                            },
                        },
                        expand: ['payment_method'],
#

this is my server site code generating setup intent
if(auth()->user()->stripe_customer_id){
$setupIntent = $stripe->setupIntents->create(
[
'customer' => auth()->user()->stripe_customer_id,
'payment_method_types' => ['us_bank_account'],
'payment_method_options' => [
'us_bank_account' => [
'financial_connections' => ['permissions' => ['payment_method', 'balances']],
],
],
],
['stripe_account' => auth()->user()->stripe_connect_account_id]

        );
    }

    return response()->json(['setupIntent' => $setupIntent]);
uneven basalt
#

what is the error?

prisma dew
uneven basalt
#

ok so the problem is in the frontend code

prisma dew
#

where?

uneven basalt
#

just a sec, I'm double checking something

#

are you using the correct keys here?

            stripeAccount: '{{ auth()->user()->stripe_connect_account_id }}',
        });```
#

the $stripe_publish_key should be your platform's publishable key

#

auth()->user()->stripe_connect_account_id should be in this particular case acct_1MKE7zR8W55xfLiR

#

could you please double check?

uneven basalt
prisma dew
#

yes I am using right key , stripe_publish_key is my plateform key and stripe_connect_account_id this is connected accout id.

prisma dew
#

req_emq0imLJGe1WEO

uneven basalt
#

that's not the one I'm looking for

prisma dew
#

ok i check

#

{
"error": {
"message": "Unrecognized request URL (GET: /v1/setup_intents/seti_1NJF2IR8W55xfLiRRsk6OzQ0/link_account_sessions). Please see https://stripe.com/docs or we can help at https://support.stripe.com/.",
"type": "invalid_request_error"
}
}
i am getting only this, not getting any request id.

Explore our guides and examples to integrate Stripe.

#

if(auth()->user()->stripe_customer_id){
$setupIntent = $stripe->setupIntents->create(
[
'customer' => 'cus_O5PTHVVb0uiUIr',
'payment_method_types' => ['us_bank_account'],
'payment_method_options' => [
'us_bank_account' => [
'financial_connections' => ['permissions' => ['payment_method', 'balances']],
],
],
],
['stripe_account' => auth()->user()->stripe_connect_account_id]

        );
    }

I think problem in setupIntent ?

#

Hello Please help me , I am totally frustrated because of this error I am not getting any solution.

quartz vault
#

Hi! I'm taking over this thread.

#

That's the first time I see that error, give me a few minutes to investigate.

prisma dew
#

Ok

quartz vault
#

Can you clarify when exactly in your flow you see that error message?

prisma dew
#

Hii soma, miraculously problem is solved.

quartz vault
#

Did you change anything on your end?

prisma dew
#

yes I recheck my code I am declaring two times stripe variable.

#

give me one answer please what i pass for fetch connect customer bank
$banks = $stripe->customers->allSources(
auth()->user()->stripe_customer_id,
['object' => 'bank_account']
);

quartz vault
#

I'm not sure I understand your question. Can you clarify what exactly you are trying to do?

prisma dew
#

I want get all customer payment method who exists in connected account.

quartz vault
final thunderBOT
prisma dew
#

Ok got it, and my second answer is

$stripe->paymentIntents->create(
[
'amount' => 1000,
'currency' => 'usd',
'automatic_payment_methods' => ['enabled' => true],
],
['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}']
);
if customer already have payment method then how i pass payment method and customer in my provided code.

tropic slate
#

👋 stepping in

#

You want to pass the PM ID to payment_method and pass confirm => true

prisma dew
#

Thank so much, you all guys help me lot.❤️

#

can I get your linkdin?

tropic slate
#

No sorry

#

But we are happy to help!