#Avinash-Ecommerce
1 messages · Page 1 of 1 (latest)
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
What Stripe API are you using? checkout session or paymentIntent?
paymentIntent
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.
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"
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.
the guide you want is https://stripe.com/docs/connect/collect-then-transfer-guide and it has full examples of the complete correct flow so I would use that!
I am using "https://stripe.com/docs/connect/destination-charges"
\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',
],
]);
@timid quiver the guide you want is https://stripe.com/docs/connect/collect-then-transfer-guide and it has full examples of the complete correct flow so I would use that!
you need a frontend here, it's not all PHP
okay thanks