#muhammad-shakir-khan_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1319285512447594536
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
how are you accepting payments? Checkout Session, Payment Element, something else?
Hi, Let me check please. I don't remember the terminology, I follwed the documentation.
I have integrated the individually api, like create customer, charge customer etc.
and how do you charge customer exactly?
public function chargeCustomer($customerId, $amount, $metaData, $request){
try {
$chargeParams = [
'currency' => 'aed',
'customer' => $customerId,
'description' => 'Charge customer for license',
'metadata' => $metaData,
'amount' => round($amount*100)
];
$charge = \Stripe\Charge::create($chargeParams);
return [
'status' => 'success',
'charge' => $charge,
];
} catch(\Stripe\Exception\CardException $e) {
return [
'status' => 'failed',
'message' => $e->getError()->message
];
} catch (\Exception $e) {
return [
'status' => 'failed',
'message' => $e->getMessage()
];
}
}
Like this.
so you are using Charges? that's a very old API that we don't recommend using
and how are you collecting the payment information from the customer? with the Card Element? that doesn't support Apple/Google Pay
instead you should use Checkout Session https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=stripe-hosted
or the Payment Element https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
and both support Apple/Google Pay
Thanks for the info, I will update with the checkout session.
And for client side I used this to show you card field
var stripePublicKey = "{{ config('services.stripe.public') }}";
var stripe = Stripe(stripePublicKey);
var elements = stripe.elements();
var card = elements.create('card', {
hidePostalCode: true,
style: {
base: {
fontSize: '16px',
color: '#32325d',
'::placeholder': {
color: '#aab7c4'
}
},
invalid: {
color: '#fa755a',
iconColor: '#fa755a'
}
}
});
Noted, Thanks.
After switching Checkout Session (or Payment Element), will it should the apple pay and google pay?
Also my stripe accont is from UAE, Can I receive apple pay and google pay payments?
with Checkout Session it works out of the box. with Payment Element you'll need to register your domain (https://docs.stripe.com/payments/payment-methods/pmd-registration)
and yes it works in the UAE.
Noted means I have to switch with Payment Element and also this domain registration.
Also I have one more concern that will apple and google pay works with all the browsers? like chrome, firefox, safari?
Google/Apple Pay will only work in supported browser, and if the user has a card saved in tehir wallets
Noted, from where I can find the supported browser list?
there's this: https://docs.stripe.com/elements/express-checkout-element#supported-browsers, and it should be similar for Checkout Session and the Payment Element
happy to help ๐
Thanks once again ๐