#krusty-paymentsheet-help
1 messages Β· Page 1 of 1 (latest)
Hello! Can I ask you to provide a lot more context/details on what you need help with?
absolutely, im playing with Stripes example app in the ExampleCustomCheckoutViewController
i wpould like to test out the FlowController UI using my own stripe account, my test user
and try out adding new payment methods
to said user
Sorry, which exact library, which language, which platform
So you are using stripe-ios?
Sorry there are multiple separate libaries and you're really deep in your question already without the high level info
yes thats correct, stripe-ios
Okay so what's the problem?
as im using my own PublishableKey
and my own customerId
im setting the key this was
STPAPIClient.shared.publishableKey = publishableKey
and i get the following error
Error Domain=com.stripe.lib Code=51 "There was an unexpected error -- try again in a few seconds" UserInfo={com.stripe.lib:ErrorMessageKey=You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/., com.stripe.lib:StripeErrorTypeKey=invalid_request_error, NSLocalizedDescription=There was an unexpected error -- try again in a few seconds, com.stripe.lib:hintKey=No valid API key provided. Set STPAPIClient.shared().publishableKey to your publishable key, which you can find here: https://stripe.com/docs/keys, com.stripe.lib:StripeErrorCodeKey=}
Please take 20 steps back lol
haha
yes exactly that one
theres a request to
https://stripe-mobile-payment-sheet.glitch.me/checkout
which send back the paymentIntent, customer, etc
i commented out the request and declared the values with my own
at the step when this gets calles
PaymentSheet.FlowController.create
is when the error happens
hope that makes more sense
yep that helps let me have a look
also on a similar note, the configuration.customer takes as input 'ephemeralKeySecret' and i cant seem to find a way to fetch this key, in case you could share some context about it, highly appreciated
an ephemeral key is a key specific to your Customer and you create it via the API, usually with a back end like the glitch
do you happen to have the reference to the API for it
There's no API reference for it sadly
What you likely want to read is carefully go through https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet-custom&uikit-swiftui=swiftui step by step
ok thanks
i can see answers to my questions about teh ephemeralKey there, thank you
as for your first question you basically have to hit https://glitch.com/edit/#!/stripe-integration-tester and remix it to do yourown version
that way you can use your own key/customer id/etc.
it's... convoluted, to say the least
Are you unblocked now? I was able to run the example myself too after having remix-ed the Glitch
i was just figuring out glitch
yeah it's not easy to grasp their UI
added mypk and sk
but once you remix, you edit the environment variables and it's already running
curl -X POST https://lizard-silly-scorpion.glitch.me/checkout
you can see the PReview at the bottom and yeah that's how you get the URL so you got this already
mostly you just need to change let backendCheckoutUrl in the code
i just did the curl in my terminal
but its just sitting there,
yeap thats what i figured
this happened when i did it from terminal
curl -X POST https://lizard-silly-scorpion.glitch.me/checkout 130 β΅
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>π» Site didn't respond</title>
<meta name="viewport" content="initial-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="https://glitch.com/edit/themes/cosmos.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
<script src="https://glitch.com/edit/error-page.js"></script>
</head>
<body class="ghost-border">
<div class="container">
<h1>
Site didn't respond
</h1>
<p>
Something in the code caused it to close the connection before providing a response.
</p>
<p>
If this is your project please visit us at <a href="https://support.glitch.com">support.glitch.com</a> for assistance.
</p>
<div class="actions">
<a href="https://glitch.com">
<div class="glitch-logo bird">
</div>
</a>
</div>
</div>
<canvas id="stars"></canvas>
</body>
</html>
im probably missing something but i should be able to figure it out
thanks
yeah the same works for me (with my own glitch URL)
is your code running already, is there anything in the Logs panel?
(also careful sharing the URL since once it works anyone can get your Secret API key from it
(node:401) UnhandledPromiseRejectionWarning: Error: Invalid Stripe API version: 2020-08-27;automatic_payment_methods_beta=v1;. You do not have permission to pass this beta header: automatic_payment_methods_beta. If you have any questions, we can help at https://support.stripe.com/.
hum
are you passing that beta header anywhere?
it's not in my remix-ed version at least
i just added my pk and sk to the .env file and that was it
can you look at server.js and see what the /checkout route looks like? Mine is // An endpoint for your checkout app.post("/checkout", async (req, res) => { var stripe = require("stripe")(process.env.secret_key);
ok now it seems to be working
weird
Performing headless installation
Total install time: 9935ms
Node server listening on port 3000!
perfect!
π₯³
okay got to run but @delicate crag can help if you have follow up questions!
Hello π
hi, koopajah was helping me with glitch
im getting this weird error when i try to call curl -X POST https://.......
(node:322) UnhandledPromiseRejectionWarning: Error: Invalid Stripe API version: 2020-08-27;automatic_payment_methods_beta=v1;. You do not have permission to pass this beta header: automatic_payment_methods_beta. If you have any questions, we can help at https://support.stripe.com/.
at Function.generate (/rbd/pnpm-volume/b53783ae-4316-4cba-97de-681e905f174e/node_modules/.registry.npmjs.org/stripe/8.96.0/node_modules/stripe/lib/Error.js:39:16)
at IncomingMessage.res.once (/rbd/pnpm-volume/b53783ae-4316-4cba-97de-681e905f174e/node_modules/.registry.npmjs.org/stripe/8.96.0/node_modules/stripe/lib/StripeResource.js:190:33)
at Object.onceWrapper (events.js:286:20)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:322) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
looking inside my server.js i can see this:
const stripe = require("stripe")(
process.env.secret_key, /* https://stripe.com/docs/keys#obtain-api-keys */
{ apiVersion: '2020-08-27;automatic_payment_methods_beta=v1;' }
);
not sure if i need to adjust this
Can you remove automatic_payment_methods_beta=v1;?
That's great π
ok im able to do what i wanted
thank you so much
Issue solved!!!!!
have a great rest of your day
Awesome! Have a nice day to you as well π€©
quick question
hope you are still around
im able to add CC using the payment sheet
but the paymentSheet only displays CC
paymentIntent is calling
automatic_payment_methods: {
enabled: true,
}
i just checked my dashboard and i have klarna, affirm and afterPay turned on
shouldnt i be able to see those payment methods as well
i also have ACH Direct Debit turned on
Can you share the request ID (req_xxx) of the Payment Intent that you created? Hereβs how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
sure thing
Payment Intent ID (pi_xxx) also works
pi_3LINE4Hnen00B3RT1lqRBfSb
thats the last one
mm im seeing in the sourceTpy only card is listed
i assumed that
automatic_payment_methods: {
enabled: true,
}
would take the enabled methods from the dashboard
im guessing i need to add the paymentMethods by hand?
I'm checking your request, the payment methods available is dependent on the currency and sometimes country too
ok you ar eright
The currency you set is in EUR:
- Affirm - only supports USD
- Klarna - the account is a US account, so it can only process USD
- AfterPay - depends on customer country
- ACH Direct Debit - only supports USD
No problem! Happy to help π
if i wanted to pass the payment methods as a list
could i do something like
const paymentIntent = await stripe.paymentIntents.create({
amount: 2500,
currency: "usd",
customer: customerId,
payment_method_type: {
}
});
and pass it as an array
i do it in CURL to create a paymentIntent as:
-d "payment_method_types[]"=affirm
-d "payment_method_types[]"=afterpay_clearpay
-d "payment_method_types[]"=klarna
You can do it with payment_method_types. We generally recommend to use automatic payment methods, so that you don't have to compute it yourself if you support multiple currencies
just USD
i see a benefit to do it manually in case i want to run experiemnts
and just have buckets of users with certain payment methods
Yup, you definitely can use payment_method_types param for finer payment method control
thank you