#sainita_code

1 messages ยท Page 1 of 1 (latest)

dusk starBOT
ripe auroraBOT
#

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.

dusk starBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260225234896818250

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

slim moon
#

As mentioned in previous thread, I have registered domain in my connected account and got this response

#

Stripe\PaymentMethodDomain JSON: {
"id": "pmd_1PadOMHcs8fOq1ZEneTRZgGv",
"object": "payment_method_domain",
"apple_pay": {
"status": "active"
},
"created": 1720529014,
"domain_name": "dev.blinkpayment.co.uk",
"enabled": true,
"google_pay": {
"status": "active"
},
"link": {
"status": "active"
},
"livemode": false,
"paypal": {
"status": "active"
}
}

wary folio
#

Can you share the site where you're seeing this behaviour?

slim moon
wary folio
#

oh, that one there

slim moon
#

I have added script for apple pay but if link is enabled I am seeing link button. Though there is no script reg link and if link is disabled, then there is no button

wary folio
#

Where is apple pay / ECE meant to appear? I see neither on that test page

slim moon
#

It should be here.. inplace of link button

#

there is one div with id "PayByStripeApplePay" .. there it should be populated but if link enabled then link button is populated there and if disabled then that div is empty

#

This is my script

#

const expressAppleCheckoutOptions = {
buttonType: {
applePay: 'buy'
},
buttonTheme: {
applePay: 'black'
}
};
const appleElements = stripe.elements({
mode: 'payment',
amount: 1099,
currency: 'gbp',
});
const expressAppleCheckoutElement = appleElements.create(
'expressCheckout',
expressAppleCheckoutOptions
);
expressAppleCheckoutElement.mount('#PayByStripeApplePay');

#

expressAppleCheckoutElement.on('click', (event) => {
if($('input[name=rawAmount]').val() == '' || $('input[name=rawAmount]').val() < 1) {
swal_fire_error('Amount is required');
return;
}
var updatedAmount = ($('input[name=rawAmount]').val()) * 100;
var updatedCurrency = $('input[name=currency_name]').val();

                    appleElements.update({amount: updatedAmount, currency:updatedCurrency});
                    const appleOptions = {
                        elementType: 'expressCheckout',
                        expressPaymentType: 'apple_pay',
                        business: {
                            name: '{{$page->url}}'
                        },
                        emailRequired: true
                    };
                    event.resolve(appleOptions);
                });
                const handleAppleError = (error) => {
                const appleMessageContainer = document.querySelector('#apple-error-message');
                appleMessageContainer.textContent = error.message;
#

expressAppleCheckoutElement.on('confirm', async (event) => {
const {error: submitError} = await appleElements.submit();
if (submitError) {
swal_fire_error(submitError);
return;
}
const appleClientSecret = XXXXX
const {appleError} = await stripe.confirmPayment({
// elements instance used to create the Express Checkout Element
appleElements,
// clientSecret from the created PaymentIntent
appleClientSecret,
redirect: 'if_required',
confirmParams: {
return_url: "{{ route('public.page.success', $page->url) }}",
},

                });

                if (error) {
                    handleAppleError(error);
                    return;
                } else {
                   
                }
                });
wary folio
#

In safari I only get the card form, no ECE (for link or apple pay)

#

I do get ECE (google pay) in chrome

slim moon
#

link is disabled now, so you won't see that.. but apple pay should be there

#

Yes. We have google pay also which is working fine

wary folio
#

The domain appears to be configured/registered correctly for the domain and that connects account, yes

#

Can you add logging to your stripe initialization to show which account ID you use?

slim moon
#

Yes

#

I have just logged the details. It is showing the correct account id

#

"id": "pmd_1PadOMHcs8fOq1ZEneTRZgGv",
"object": "payment_method_domain",
"apple_pay": {
"status": "active"
},
"created": 1720529014,
"domain_name": "dev.blinkpayment.co.uk",
"enabled": true,
"google_pay": {
"status": "active"
},
"link": {
"status": "active"
},
"livemode": false,
"paypal": {
"status": "active"
}
} ---- Here livemode is showing false, will it be true?

wary folio
#

livemode vs testmode depends on whether you're trying to do this in test mode (with a test PK) or live mode

slim moon
#

Our platform api key is in live mode

#

pk_live....................

wary folio
#

Then you'd need to register the domain in live mode, too. But you should be testing in test mode first.

slim moon
#

Is it possible to test the the payment in test mode?

#

We got the details that to test apple pay, we need to be in live mode

#

Is it possible to update this livemode value to true using API?

wary folio
#

Is it possible to test the the payment in test mode?
Yes, switch to using your test keys on your site. Since this looks like a dev env you should likely be using that there already.

#

We got the details that to test apple pay, we need to be in live mode
Where were you told that? You can test Apple Pay in test mode, certainly.

#

Is it possible to update this livemode value to true using API?
No, you need to make a separate request using your live secret key to register for live mode, but I would suggest testing in test mdoe first.

slim moon
#

ok

#

Yes. Now, in test mode I can see the button but after clicking the button and selecting a card, I am getting this error message in console and the page is stuck then. There is no message reg payment successful or failed

wary folio
#

That first line suggests an integration error

#

An the later lines reveal what that might be

#
const appleOptions = {
                            elementType: 'expressCheckout',
                            expressPaymentType: 'apple_pay',
                            business: {
                                name: '{{$page->url}}'
                            },
                            emailRequired: true
                        };
                        event.resolve(appleOptions);
#

You shared that earlier, and it includes some invalid parameters

#

Specifically, the two mentioned in those errors

slim moon
#

In this page , it is showing me those params

wraith rock
#

Hi there ๐Ÿ‘‹ jumping as my teammate needs to step away soon. I'm not seeing the elementType or expressPaymentType parameters, that the error messages are saying aren't recognized/supported parameters, in the screenshot that you shared.

slim moon
#

It's in the right side

#

that place where event handler object is shown

wary folio
#

That's the event object, with the resolve function, not the parameters for resolve

slim moon
#

Ok. If I remove these two params, still regarding the first error,

wary folio
#

Those are properties you can inspect to understand the event you're processing, not something you provide

#

Fixing those should resolve the first error too

slim moon
#

ok

#

The errors are gone now and it's working . Thanks for all your help.