#kelvin_docs
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/1390164393131638876
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- kelvin_error, 1 day ago, 13 messages
we want to control showing stripe payment methods and only card in working for the param of "paymentMethodTypes", how can we pass additional payment methods? like 'grabpay', 'paynow', 'alipay'
hello! what's the exact error message you're seeing?
initPaymentSheet doesn't give any error, it return empty object {}, meanwhile presentPaymentSheet show "FlowController must be successfully initialized using configureWithPaymentIntent(), configureWithSetupIntent() or configureWithIntentConfiguration() before calling presentPaymentOptions()"
sorry, I'm a bit confused, so earlier when you said
try to pass ['card', 'paynow', 'grabpay'] fail, try to pass cutom array ['something', 'card'] fail
You didn't mean that it was throwing an error?
oh sorry, confuse message
yeah to clarify, i mean fail when it throw error, and it just throw error with presentPaymentSheet, no error on initPaymentSheet
can you share your code snippet, where you tried passing in ['card', 'paynow', 'grabpay'] as an example
sure
this is what is pass as config to initPaymentSheet
"merchantDisplayName": "Pelago",
"appearance": {
"font": {
"family": "NunitoSans10pt-Regular"
},
"shapes": {
"borderRadius": 12,
"borderWidth": 0.5
},
"primaryButton": {
"shapes": {
"borderRadius": 5
}
},
"colors": {
"primary": "#000000",
"background": "#ffffff",
"componentBackground": "#ffffff",
"componentBorder": "#e6e6e6",
"componentDivider": "#e6e6e6",
"primaryText": "#000000",
"secondaryText": "#999999",
"componentText": "#000000",
"placeholderText": "#999999"
}
},
"customerId": "e74de590-627f-4e5e-8198-e9629f01e6cf",
"primaryButtonLabel": "Pay US$23.54",
"allowsDelayedPaymentMethods": true,
"returnURL": "pelago://stripe_checkout/PG2507MLOPBC_plq1t",
"customFlow": true,
"defaultBillingDetails": {
"address": {
"country": "SG"
}
},
"intentConfiguration": {
"mode": {
"amount": 2354,
"currencyCode": "USD"
},
"paymentMethodTypes": [
"card",
"grabpay",
"alipay",
"paynow",
"wechat_pay"
]
}
}
Hi @dusk marlin I'm also an engineer from Stripe. Let me take a look at this.
hi Jack, thanks
How do you initilize the PaymentSheet? Can you share with me the code?
const config = {
merchantDisplayName: 'Company',
appearance: customAppearance,
customerId,
primaryButtonLabel: payLabel,
allowsDelayedPaymentMethods: true,
returnURL: returnUrl,
customFlow: true,
defaultBillingDetails: {
address: {
country: getCountry() ?? 'SG',
},
},
intentConfiguration: {
mode: {
amount: price * 100,
currencyCode: currentCurrencyId ?? FALLBACK_CURRENCY,
},
paymentMethodTypes: supportedPaymentMethods,
confirmHandler: confirmHandler,
},
}
await initPaymentSheet(config)
and here is the config
{
"merchantDisplayName": "Pelago",
"appearance": {
"font": {
"family": "NunitoSans10pt-Regular"
},
"shapes": {
"borderRadius": 12,
"borderWidth": 0.5
},
"primaryButton": {
"shapes": {
"borderRadius": 5
}
},
"colors": {
"primary": "#000000",
"background": "#ffffff",
"componentBackground": "#ffffff",
"componentBorder": "#e6e6e6",
"componentDivider": "#e6e6e6",
"primaryText": "#000000",
"secondaryText": "#999999",
"componentText": "#000000",
"placeholderText": "#999999"
}
},
"customerId": "e74de590-627f-4e5e-8198-e9629f01e6cf",
"primaryButtonLabel": "Pay US$23.54",
"allowsDelayedPaymentMethods": true,
"returnURL": "pelago://stripe_checkout/PG2507MLOPBC_plq1t",
"customFlow": true,
"defaultBillingDetails": {
"address": {
"country": "SG"
}
},
"intentConfiguration": {
"mode": {
"amount": 2354,
"currencyCode": "USD"
},
"paymentMethodTypes": [
"card",
"grabpay",
"alipay",
"paynow",
"wechat_pay"
]
}
}
Ok, can you do a const { error } = await initPaymentSheet() and see if initPaymentSheet retruns any errors?
yes , there is an error
{
"error": {
"stripeErrorCode": "",
"declineCode": null,
"localizedMessage": "There was an unexpected error -- try again in a few seconds",
"message": "The currency provided (usd) is invalid. Payments with grabpay support the following currencies: sgd.",
"type": "invalid_request_error",
"code": "Failed"
}
}
Ok, so now we know what the problem is.
You'll want to change the currency to sgd if you want to offer grabpay, alipay, paynow or wechat_pay to your customer.
thank you so much Jack
i got the point now
1 more question Jack
on Android only, the paymentSheet show, but there is no methods show up
same code, same config but happen on Android only
what do you mean by " but there is no methods show up", can you send a screenshot?
Looks liks the currency is still USD. Can you share with me the latest intentConfiguration in your code?
{
"merchantDisplayName": "Company",
"appearance": {
"font": {
"family": "NunitoSans10pt-Regular"
},
"shapes": {
"borderRadius": 12,
"borderWidth": 0.5
},
"primaryButton": {
"shapes": {
"borderRadius": 5
}
},
"colors": {
"primary": "#000000",
"background": "#ffffff",
"componentBackground": "#ffffff",
"componentBorder": "#e6e6e6",
"componentDivider": "#e6e6e6",
"primaryText": "#000000",
"secondaryText": "#999999",
"componentText": "#000000",
"placeholderText": "#999999"
}
},
"customerId": "e74de590-627f-4e5e-8198-e9629f01e6cf",
"primaryButtonLabel": "Pay US$13.81",
"allowsDelayedPaymentMethods": true,
"returnURL": "pelago://stripe_checkout/PG2507UEDGLF_pbgop",
"customFlow": true,
"defaultBillingDetails": {
"address": {
"country": "SG"
}
},
"intentConfiguration": {
"mode": {
"amount": 1381,
"currencyCode": "USD"
},
"paymentMethodTypes": []
}
}
Looks like you didn't specify any paymentMethodTypes
you shouldn't need to pass in paymentMethodTypes at all. It's an optional parameter. If you don't pass this in, it will use the Payment Method Configuration configured in your Dashboard
is this specific to Android that i should pass paymentMethodTypes when i want it empty? because it works on iOS
i've just tried to not pass the paymentMethodTypes but it also show empty payment sheet
here is the config:
{
"merchantDisplayName": "Company",
"appearance": {
"font": {
"family": "nunitosans10ptregular"
},
"shapes": {
"borderRadius": 12,
"borderWidth": 0.5
},
"primaryButton": {
"shapes": {
"borderRadius": 5
}
},
"colors": {
"primary": "#000000",
"background": "#ffffff",
"componentBackground": "#ffffff",
"componentBorder": "#e6e6e6",
"componentDivider": "#e6e6e6",
"primaryText": "#000000",
"secondaryText": "#999999",
"componentText": "#000000",
"placeholderText": "#999999"
}
},
"customerId": "22035ae1-a78f-42be-9d29-0e97d518e8d1",
"primaryButtonLabel": "Pay $17.60",
"allowsDelayedPaymentMethods": true,
"returnURL": "pelago://stripe_checkout/PG2507DYIXAB_pbgop",
"customFlow": true,
"defaultBillingDetails": {
"address": {
"country": "GB"
}
},
"intentConfiguration": {
"mode": {
"amount": 1760.0000000000002,
"currencyCode": "SGD"
}
}
}
Can you tell me what you want to achieve?
we want to show all the payment methods for this product checkout, so we expect to have all available payment methods "card, grabpay, alipay, etc..." show up, or at least "card" show up, but it's empty
Does the card show up now when you omit the paymentMethodTypes ?
no, it doesn’t 🥹
Can you share with me your Stripe account ID? (i.e., acct_xxx)
No worries, let me take over this thread
hi guys, thank you for the support, i can figure it out, calculation in price trigger JS issue of floating point
0.1 + 0.2 = 0.3000000000000004
when multiply with 100, it's still 30.0000000004, and it show empty payment methods
Ah I see. Stripe expects the amount to be integer.