#mohamedamineelgaouzi
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- mohamedamineelgaouzi, 39 minutes ago, 7 messages
Hello! Can you share the request ID with me?
hello , i was using transfer_data then chaged to direct payment , and this error apeared here my backend fucntion ; paymentMethodid i get from client side
public function paySuccess(Request $request, int $bookingId, string $paymentMethodId)
{
$this->booking = $this->bookingRepository->findWithoutFail($bookingId);
$this->stripePaymentMethodId = $paymentMethodId;
$totalAmount = $this->booking->getTotal() * 100;
$totalBeforCom = $this->booking->getTotalBeforCom() * 100;
$fraisGlowApp = $totalAmount - $totalBeforCom;
try {
Stripe::setApiKey(config('services.stripe.secret'));
$intent = PaymentIntent::create([
'amount' => (int)($totalAmount),
'currency' => 'eur',
'payment_method' => $this->stripePaymentMethodId,
'description' => 'Payment for booking #'.$this->booking->id.'',
'application_fee_amount' => $fraisGlowApp,
// 'transfer_data' => [
// 'destination' => $this->booking->salon->users[0]->stripe_connect_id
// ],
],
['stripe_account' => $this->booking->salon->users[0]->stripe_connect_id]
);
$intent = PaymentIntent::retrieve($intent->id);
$intent = $intent->confirm();
if ($intent->status == 'succeeded') {
$this->paymentMethodId = 7;
$this->paymentIntentId = $intent->id;
$this->createBooking();
}
return $this->sendResponse($intent, __('lang.saved_successfully'));
} catch (ApiErrorException $exception) {
return back()->withErrors(['message' => $exception->getMessage()]);
}
}
Thanks for sending over your code, but it would be more helpful if you shared a request ID - It should look something like req_123
oaky ,
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such PaymentMethod: 'pm_1O82wSDUHiJiBcBZiztbZZ3V'; OAuth key or Stripe-Account header was used but API request was provided with a platform-owned payment method ID. Please ensure that the provided payment method matches the specified account.",
"param": "payment_method",
"request_log_url": "https://dashboard.stripe.com/acct_1O7KAwRjjunj7uU8/test/logs/req_0ihcuSicsmyI7N?t=1698939383",
"type": "invalid_request_error"
}
}
i changed from stripe express acounts to stripe standard, but i seem to have problem with paymentmethodid when creating payment intent
this was not the case when i was using transfer_data
but i need the stripe fees to be detucted from connected accoutn , thats whay i changed to standard connected account ,
Taking a look now! Give me a minute
okay thnkx
When you were using express accounts, were you also using destination charges?
when
using express accounts i used destination charge, now i commented it , to do direct payment
Yeah so with direct payments you need to be using a Paymnet Method on the connected account. The payment method you're using here is on the platform account, which is why the direct charge on the connected account doesn't work
yes exactly
how to do so ?
because paymentmethod im using on client side with js, and receiving it on backend php laravel
You'd do this by setting the Stripe-Account header client-side (https://stripe.com/docs/connect/authentication?client=create-client-js#adding-the-connected-account-id-to-a-client-side-application)
var stripe = Stripe('{{setting('stripe_key')}} ');
stripe.createPaymentMethod({
type: 'card',
card: elements[0],
'billing_details': additionalData
}).then(function(result) {
// Stop loading!
console.log(result);
if (result.paymentMethod) {
$.ajax({
type: 'GET',
url: "{!! url('payments/stripe/pay-success',['booking_id' => $booking->id]) !!}/" +
result.paymentMethod.id,
success: function(result) {
console.log(result);
window.location.href = "{!! url('payments/stripe') !!}";
example.classList.remove('submitting');
example.classList.add('submitted');
},
error: function(err) {
enableInputs();
}
});
} else {
// Otherwise, un-disable inputs.
enableInputs();
}
});
thansk for your guidance
i will look on link you just sent
👍
var stripe = Stripe('{{PLATFORM_PUBLISHABLE_KEY}}', {
stripeAccount: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
});
??
i do this ?
Yes