Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does appear error on Stripe payment request button?

Stripe payment request button for Google pay does not appear.

I need to implement payment request button for google pay in angular app. I was implementing this regarding docs : https://stripe.com/docs/stripe-js/elements/payment-request-button#verifying-your-domain-with-apple-pay

I'v added trusted SSL Sertificate for my app on localhost. But still receive this issue:

IntegrationError: The paymentRequestButton Element is not available in the current environment.
at new t (https://js.stripe.com/v3/:1:10518)
at t.<anonymous> (https://js.stripe.com/v3/:1:94978)
at t.mount (https://js.stripe.com/v3/:1:24449)

My code :

this.stripe = Stripe('pk_test_key');

    this.elements = this.stripe.elements();  

    const paymentRequest = this.stripe.paymentRequest({
        country: 'US',
        currency: 'usd',
        total: {
            label: 'Demo total',
            amount: 1000,
        },
        requestPayerName: true,
        requestPayerEmail: true,
    });

 this.payServices = this.elements.create('paymentRequestButton', {
        paymentRequest: paymentRequest,
});
await paymentRequest.canMakePayment()
    .then(r => {
        this.payServices.mount(this.services.nativeElement);
    })
.catch(e => console.log(e));

Expect workable button even on localhost

like image 665
Alex R. Avatar asked Oct 22 '25 08:10

Alex R.


1 Answers

Fixed. The issue was in :

country: 'US',
    currency: 'usd',

I'v changed to:

 country: 'GB',
        currency: 'eur',

And everything works fine. Thank you! I think there is dependency of you Stripe account country.

like image 130
Alex R. Avatar answered Oct 24 '25 23:10

Alex R.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!