#piyushjain_api

1 messages ยท Page 1 of 1 (latest)

ancient jewelBOT
#

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

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

frank jacinth
#

Please help me

#

i am facing this from last 2 weeks.. my clients are asking to enable apple pay

civic dove
#

Hello ๐Ÿ‘‹

What Stripe components are you using?

#

Where are you trying to display Apple Pay as an option? Web, iOS?

frank jacinth
#

Yes Apple Pay on safari . I am using stripe.js and using StripeCardElement

civic dove
#

Stripe Card Element does not support Apple Pay

#

You need to implement the Payment Element or Express Checkout Element

frank jacinth
#

By using it i can see google pay on chrome and android phone

civic dove
#

Can you share the Javascript code you are using to create your Card Element?

frank jacinth
#

I m sorry itโ€™s payment element

civic dove
#

Ah, okay

#

that would explain the discrepancy

frank jacinth
#

<div class="payment-container">
<div id="payment-element"></div>
</div>

<div id="payment-request-button" style="margin-top: 20px;"></div>
<div id="payment-message"></div>

civic dove
#

Ah, are you using Stripe.js to load the Payment Request Button

frank jacinth
#

yes

#

private async initializeStripe(accountId: string) {
const publishableKey = environment.STRIPE_PUBLIC_KEY;
const stripeInstance = await this.createStripeInstance(publishableKey, accountId);

if (!stripeInstance) return;

const amount = this.data.totalAmount * 100;
const paymentModel = { totalAmount: this.data.totalAmount, platformFee: this.data.platformFee };

this.paymentService.getSecretKey(this.store.id, paymentModel).subscribe(async (res) => {
  const clientSecret = res.secret;

  this.setupElements(clientSecret);

  this.setupPaymentRequest(amount, clientSecret);
});

}

#

private setupElements(clientSecret: string) {
this.elements = this.stripe.elements({
clientSecret,
appearance: {
theme: 'flat',
variables: {
colorPrimary: '#fbc02d',
colorBackground: '#ffffff',
colorText: '#000000',
colorDanger: '#df1b41',
fontFamily: 'system-ui',
spacingUnit: '6px',
borderRadius: '8px',
},
rules: {
'.Input': { borderColor: '#fbc02d', color: '#000000' },
'.Tab': { color: '#fbc02d' },
'.Tab--selected': { borderColor: '#fbc02d', color: '#fbc02d' },
'.Block': { backgroundColor: '#ffffff' },
'.Label': { color: '#fbc02d' },
'.Link': { color: '#fbc02d' },
'.Error': { color: '#df1b41' },
},
}
});

// Optional: mount card input instead of payment request
// const paymentElement = this.elements.create('payment', { layout: { type: 'tabs' } });
// paymentElement.mount('#payment-element');

}

#

private async setupPaymentRequest(amount: number, clientSecret: string) {
const paymentRequest = this.stripe.paymentRequest({
country: 'CH',
currency: 'chf',
total: {
label: 'Amount',
amount: amount,
},
requestPayerName: true,
requestPayerEmail: true,
});

const result = await paymentRequest.canMakePayment();

if (result) {
  const prButton = this.elements.create('paymentRequestButton', {
    paymentRequest,
    style: {
      paymentRequestButton: {
        type: 'buy',
        theme: 'light',
        height: '40px',
      },
    },
  });

  prButton.mount('#payment-request-button');

  paymentRequest.on('paymentmethod', (ev) =>
    this.handlePaymentMethod(ev, clientSecret)
  );
} else {
  const prBtn = document.getElementById('payment-request-button');
  if (prBtn) prBtn.style.display = 'none';
  console.warn('Payment Request API not available');
}

}

civic dove
#

For the payment request, can you make the canMakePayment() function call and log what it returns?

frank jacinth
#

{
apple: false,
google: false,
link: false
}

civic dove
#

Okay so the browser is not properly configured to make payments

frank jacinth
#

in safari

#

in chrome (windows) google is true

#

i feel this issue is with my account

civic dove
#

I can't help with account issues but I can try to debug further. Do you have a publicly accessible URL I can check?

frank jacinth
#

here is the issue.. configure ios certificate

civic dove
#

That is not the issue

#

That would only be a problem if you were trying to build Apple Pay into an iOS application

frank jacinth
#

no .. configure IOS certificate isnot done .

#

ohh

#

oh okay.. let me share url

#

give me a min please

civic dove
#

No worries

frank jacinth
civic dove
#

I see an error stating the Payment Request API is not available in this context

frank jacinth
#

possible if you can share screenshot ?

#

I can see this error

civic dove
#

The modal doesn't load anything and this is what I see in the console

frank jacinth
#

As warning

#

Yes. Because this api failed

#

that's why we cant see anything on model

#

but in chrome .. let me share screenshot

civic dove
#

Unfortunately this isn't something Stripe controls

#

The PaymentRequest API is something that web browsers implement

frank jacinth
#

but this is successfully done from browser.. it is working in chrom

#

please help me

#

what i should do in this case

civic dove
#

Right, but Safari is a different browser

frank jacinth
#

possible if you can see this same url in chrome

#

oh.. what should i enable or do in safari

#

for this ?

civic dove
#

Wait... this is coming from your code

#
const result = await paymentRequest.canMakePayment();

    if (result) {
      const prButton = this.elements.create('paymentRequestButton', {
        paymentRequest,
        style: {
          paymentRequestButton: {
            type: 'buy',
            theme: 'light',
            height: '40px',
          },
        },
      });

      prButton.mount('#payment-request-button');

      paymentRequest.on('paymentmethod', (ev) =>
        this.handlePaymentMethod(ev, clientSecret)
      );
    } else {
      const prBtn = document.getElementById('payment-request-button');
      if (prBtn) prBtn.style.display = 'none';
      console.warn('Payment Request API not available'); // <- Here
    }
frank jacinth
#

that's right ... this is in my code

civic dove
#

Okay well I can confirm my browser is properly set up. Can you share a payment intent ID so I can check a few things here?

frank jacinth
#

okay wait let me get

#

pi_3Rg1RMPcCRWtyajj0S5dpIAR

#

This is what I got from wallet-config api

civic dove
#

Thanks, taking a look

frank jacinth
#

hi

civic dove
#

Still looking

frank jacinth
#

oh okay. sorry for disturbing .

civic dove
#

This request is a direct request on a Connect Account. The connect account does not have any Apple Pay domains registered

frank jacinth
#

ohh. i sec please let me check

#

i have added domain in his account. let me verify

civic dove
#

Apple Pay does not consider this domain valid

frank jacinth
#

Okay.. i think you are right.. i cant add domain in his account right ?

#

he only need to add domain.

ancient jewelBOT
nocturne pewter
frank jacinth
#

Oh okay

#

let me do that.