#piyushjain_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/1389547381200130108
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Please help me
i am facing this from last 2 weeks.. my clients are asking to enable apple pay
Hello ๐
What Stripe components are you using?
Where are you trying to display Apple Pay as an option? Web, iOS?
Yes Apple Pay on safari . I am using stripe.js and using StripeCardElement
Stripe Card Element does not support Apple Pay
You need to implement the Payment Element or Express Checkout Element
By using it i can see google pay on chrome and android phone
Can you share the Javascript code you are using to create your Card Element?
I m sorry itโs payment element
<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>
Ah, are you using Stripe.js to load the Payment Request Button
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');
}
}
For the payment request, can you make the canMakePayment() function call and log what it returns?
{
apple: false,
google: false,
link: false
}
Okay so the browser is not properly configured to make payments
in safari
in chrome (windows) google is true
i feel this issue is with my account
I can't help with account issues but I can try to debug further. Do you have a publicly accessible URL I can check?
here is the issue.. configure ios certificate
That is not the issue
That would only be a problem if you were trying to build Apple Pay into an iOS application
no .. configure IOS certificate isnot done .
ohh
oh okay.. let me share url
give me a min please
No worries
https://qr.tapgo.ch/9lcs9h/2/Interieur 1
click on pickup.. and select product. on checkout page click on pay now button.. and then online payment
I see an error stating the Payment Request API is not available in this context
The modal doesn't load anything and this is what I see in the console
As warning
Yes. Because this api failed
that's why we cant see anything on model
but in chrome .. let me share screenshot
Unfortunately this isn't something Stripe controls
The PaymentRequest API is something that web browsers implement
but this is successfully done from browser.. it is working in chrom
please help me
what i should do in this case
Right, but Safari is a different browser
possible if you can see this same url in chrome
oh.. what should i enable or do in safari
for this ?
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
}
that's right ... this is in my code
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?
okay wait let me get
pi_3Rg1RMPcCRWtyajj0S5dpIAR
This is what I got from wallet-config api
Thanks, taking a look
hi
Still looking
oh okay. sorry for disturbing .
This request is a direct request on a Connect Account. The connect account does not have any Apple Pay domains registered
Apple Pay does not consider this domain valid
Okay.. i think you are right.. i cant add domain in his account right ?
he only need to add domain.
You can do it via the API as the platform: https://docs.stripe.com/payments/payment-methods/pmd-registration?dashboard-or-api=dashboard#register-your-domain-while-using-connect