#Avinash-Ecommerce

1 messages · Page 1 of 1 (latest)

novel thunder
#

Hi there, how can I help? can you elaborate more on the problem?

timid quiver
#

Hi Jack

#

We have c-com website where product are being sold by diffrent sellers

#

user purchase the product

#

Payment process is working fine, we are able to recive the payment

#

but main issue is that how we know that which paument is associated with which seller

#

connected account

novel thunder
#

What Stripe API are you using? checkout session or paymentIntent?

timid quiver
#

paymentIntent

novel thunder
#

OK, you can create a connect webhook endpoint and listen to the payment_intent.succeeded event, the event object contains the connected account id and the paymentIntent object.

timid quiver
#

I am using this

#

$charge = \Stripe\PaymentIntent::create([
'payment_method_types' => ['card'],
'payment_method' => $method->id,
'amount' => 2000,
'currency' => 'usd',
'transfer_data' => [
'destination' => 'acct_1KjeAeQKH3eTUjoP',
],
]);

#

i am using api

#

$method = \Stripe\PaymentMethod::create([
'type' => 'card',
'card' => [
'number' => '4111111111111111',
'exp_month' => 12,
'exp_year' => 2023,
'cvc' => '123',
],
]);

              $charge =    \Stripe\PaymentIntent::create([
                  'payment_method_types' => ['card'],
                  'payment_method' => $method->id,
                  'amount' => 2000,
                  'currency' => 'usd',
                  'transfer_data' => [
                    'destination' => 'acct_1KjeAeQKH3eTUjoP',
                  ],
              ]);
#

but it's getting error

#

"The customer has not completed the payment"

low epoch
#

did you confirm the PaymentIntent on the frontend?

#

also you can not do that \Stripe\PaymentMethod::create call on the backend with raw card numbers, it's not PCI compliant.

timid quiver
#

\Stripe\Stripe::setApiKey('sk_test_51HRXUnKQrvlZ36ZBgKTj6Dhd6X0u2hihxI1ESNMf7SLvGCj5VdoHQ3iTLscWZqMLYCedPbHEZh2bc95BWC7lQsbU00nPP7EaYI');

$payment_intent = \Stripe\PaymentIntent::create([
'payment_method_types' => ['card'],
'amount' => 1000,
'currency' => 'usd',
'transfer_data' => [
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
],
]);

#

code of script

#

but first it's getting error

#

"The customer has not entered their payment method."

#

when i add th script in existing script

#

$method = \Stripe\PaymentMethod::create([
'type' => 'card',
'card' => [
'number' => '4111111111111111',
'exp_month' => 12,
'exp_year' => 2023,
'cvc' => '123',
],
]);

low epoch
#

you need a frontend here, it's not all PHP

timid quiver
#

okay thanks