#muhammad-shakir-khan_api

1 messages ยท Page 1 of 1 (latest)

brittle juniperBOT
#

๐Ÿ‘‹ 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.

spare schooner
#

hi there!

#

how are you accepting payments? Checkout Session, Payment Element, something else?

little star
#

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.

spare schooner
#

and how do you charge customer exactly?

little star
#

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.

spare schooner
#

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

little star
#

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'
}
}
});

spare schooner
#

got it

#

yes using Checkout Session (or Payment Element) would be much better

little star
#

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?

spare schooner
#

and yes it works in the UAE.

little star
#

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?

spare schooner
#

Google/Apple Pay will only work in supported browser, and if the user has a card saved in tehir wallets

little star
#

Noted, from where I can find the supported browser list?

spare schooner
little star
#

Noted, Thanks.

#

I got the idea.

spare schooner
#

happy to help ๐Ÿ™‚

little star
#

Thanks once again ๐Ÿ™‚