#Srujan
1 messages · Page 1 of 1 (latest)
hello! can you share your test site?
Sure
Click on whistle stop, add an item, go to cart, go to checkout, enter name and phone and try the google pay flow
Try the card flow to see what i'm trying to replicate with google
I can post my submit handler or even my checkout and PaymentForm components
yep, can you share your submit handler code also?
gimme a while to scan through it
Btw I have manual capture when creating payment intents
so I want to be able to capture or cancel based on the rest of the flow after confirmPayment is called
is the issue that you see a developer error?
Well that is an issue I think, but I'm not sure if that's whats causing the google payment to not go through. I examine the payments and it looks like the payment gets canceled. But this doesn't happen on the normal CC flow so idk why the dev error is popping up
Oh you mean unexpected dev error
yeah that's the issue
{code: 'incomplete', type: 'validation_error', message: 'Please fill in your card details.'} I do get this from the error log after confirmPayment so it looks like that's going through
i'm getting a
pay.js:143 DEVELOPER_ERROR in loadPaymentData: Invalid stripe:publishableKey for current environment. Make sure you are using Stripe's test key.
Yeha I got that before. But it's confusing because my publishable key and account id are in order and working
I can post those if you need
so are you saying you're no longer receiving that error?
I don't see that error but was getting it a few hours ago...
That link is what I'm testing on
first lets resolve the issue with that error message, the reason you're getting that is probably because the connected account is connected in livemode to your platform. Usually that allows you to also make test mode API requests on their behalf, but it doesn’t work with Google Pay, for a technical reason — it will only work with Google Pay in live mode(using livemode API keys).
can you use a connected account created specifically in test mode instead
for context, this is the connected account you've specified in your code right now : acct_1LowvdDTwu9XYxBB
Right...oh I think I've run into this issue before
Okay so I can't use a connect account created in live mode, I have to use a test mode created connect account?
yep, that should resolve the issue, lets try and see
okay, just to make sure can you check this account ID? acct_1LT8QGQo4ogIFLAC to see if it's compatible? I should be able to use the same publishable key right? Do I need to change anything on the backend for this to work?
acct_1LT8QGQo4ogIFLAC should be fine. yes, you can use the same publishable key.
You need to update the account id specified here client side
publicKey:
'pk_test_...',
accountId: 'acct_...'
};```
you probably need to change something in the backend also - the Stripe-Account header : https://stripe.com/docs/connect/authentication
but you'll need to look through your own backend code to see where's that defined
I can't change the backend unfortunately, no write access =/ I guess I'll have to do this tomorrow with the team, but let's see if I can get something now
This is the new link https://e2c6-2601-281-8000-25c-d03d-1665-c5af-4e19.ngrok.io/
Yeah the payment element doesn't render because I think the authentication issue
yeah, you need to load the PaymentIntent created with the same stripe account
Yup
as a workaround, do you think you could try manually creating one with curl and the stripe account header then hardcoding it locally?
Do you mean creating a paymentintent?
yep
Yeah I can try for sure
Is curl just a command I would type into terminal haven't done that in a while
onesec, let me pull the command
Like following this? https://stripe.com/docs/api/payment_intents/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'd have to find the sk_test key
Where does the stripe account header go?
curl https://api.stripe.com/v1/payment_intents \
-u sk_test_....: \
-d amount=2000 \
-d currency=usd \
-d "payment_method_types[]"=card \
-H Stripe-Account:acct_
yep
make sure that the public key is the same as what you're using client side also, so as to ensure you're using the secret key for the correct account id
Yup it's the same
so where would I enter this curl command? Would I see the client Secret and just hardcode into the app?
in the terminal
just in my terminal?
Oh okay sweet thanks
Do I change the payment_method_type to google_pay?
nope, card is correct
okay sweet
oh, i forgot about your manual capture, but i guess we can update that later
lets make sure we can get the element to load first when you hardcode it
This is what I tried, just hard coded the client Secret but I'm still getting 404s
don't paste your secret key here even if it's for testmode
sorry
Lemme fix that
-u
: \
-d amount=2000 \
-d currency=usd \
-d "payment_method_types[]"=card \
-H Stripe-Account: acct_1LT8QGQo4ogIFLAC
{
"id": "pi_3MGxdMJlV60ASTL6011Icras",
"object": "payment_intent",
"amount": 2000,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"charges": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": "/v1/charges?payment_intent=pi_3MGxdMJlV60ASTL6011Icras"
},
"client_secret": "pi_3MGxdMJlV60ASTL6011Icras_secret_g4crbFqU66OKGVeYATdXiE1A2",
"confirmation_method": "automatic",
"created": 1671511256,
"currency": "usd",
"customer": null,
"description": null,
"invoice": null,
"last_payment_error": null,
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"transfer_data": null,
"transfer_group": null
}curl: (6) Could not resolve host: acct_1LT8QGQo4ogIFLAC```
ah okay
you're no longer getting curl: (6) Could not resolve host: acct_1LT8QGQo4ogIFLAC right?
yup
and it looks like it worked!
got a status succeeded
okay so wow it's the connected account issue
totally forgot about that
No way to test a live mode created connect account?
it's just one of those weird and strange quirks i'm afraid
Well thank you for the help
So...I'll have to update the backend to use this test mode created connect account and I should be good to go then. Thanks so much!
feel free to reach out again if you're still having trouble
@tall jay on a side note though, wanted to flag it in case it's important - that connected account acct_1LT8QGQo4ogIFLAC is a Custom connected account. Whereas the originally one you used was a Standard connected account
it wouldn't process differently, but just so you're aware in case you have other tests that you're running which may depend on the connected account being a Standard connected account
also, i wanted to highlight some other points about Apple Pay
Yes please
Could I create a standard connected account in test mode that would satisfy both requirements?
yep that's totally possible, just use Account API with the test API key to create the test account, then use Account Links to go through the onboarding flow
because you're doing what we call a Direct Charge, you need to remember to register the Stripe Apple Pay domain on the connected account using your platform's secret key and the Stripe-Account header as documented here : https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-using-with-connect.
Note :
- You must use the live secret key to register the domains; don’t add domains in test mode.
- Gentle reminder that this domain registration must be done via the API. It's not possible to register the domain (on behalf of the connected account using the Stripe-Account header) via the Dashboard.
ah yeah that's the agenda tomorrow
also, testing must be done with a real live card added to your apple pay wallet
i think that's about the common issues that most users reach out to us for
I'm a little confused though, what do you mean by You must use the live secret key to register the domains; don’t add domains in test mode.?
so when you register the Apple Pay domain, you must use the sk_live_ key
i.e. the live secret key
it's a common mistake that when users register the Apple Pay domain, they use the sk_test_ i.e. the test secret key
Ah I see
So you're talking specifically about this Register all domains on which the Payment Request Button will be shown with Apple Pay. You can use the Stripe API for this, using your platform’s secret key to authenticate the request, and setting the Stripe-Account header to your connected account’s Stripe ID, as described in Making API calls for connected accounts.?
specifically this line
You must use your platform’s live secret key to register the domains – don’t add domains in test mode.
Right
Okay cool
Can I use curl for this? Like curl https://api.stripe.com/v1/apple_pay/domains \ -u {PLATFORM_SECRET_KEY}: \ -H "Stripe-Account: {{CONNECTED_ACCOUNT_ID}}" \ -d domain_name="example.com" ? I could do that now without modifying the backend and it would be permanent?
yeah, you can do it using cURL too
hrm, i guess yes, you can think of it as it's permanent
okay sweet I was waiting on backend team to do this but I'm gonna go ahead and take care of that now
you're going to need to re-register your domain everytime your ngrok tunnel domain changes 😅
yeah that makes sense, was thinking of getting them to get me a permanent registered domain
for testing
seriously though this was a huge help...the curl is powerful
you don't necessarily have to use cURL. As long as you have the secret key, you could write everything in the language you prefer
i'm going to step away for the day 😃 . My colleague will be around if you have other follow up questions
Hi @tall jay I'm taking over. Let me know if you have any follow-up questions.
Thanks Alex! And hi Jack! I appreciate you guys' help
I'm going to try and register some domains and see if I can get apple pay to show now
will let you know if I have any questions
Okay so I did register my ngrok address with the connect account id and my sk test key but I'm still getting this error in safari when trying to view my payment element Either you do not have a card saved to your Wallet or the current domain (e2c6-2601-281-8000-25c-d03d-1665-c5af-4e19.ngrok.io) or stripeAccount parameter (acct_1LT8QGQo4ogIFLAC) is not registered for Apple Pay. Visit https://dashboard.stripe.com/account/apple_pay to register this domain.
Oh wait I need to register one sec
you didn't register it with your live key
Yup I'm still getting that error, does it take a second for the registration to go through? To recap, I've hosted the domain association file at the right endpoint, I've gone to https://dashboard.stripe.com/settings/payments/apple_pay to register the ngrok link, and I've used the curl account to register the account ID
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yeah I got back { "id": "apwc_1MGybOQo4ogIFLAC0y9ANJ6l", "object": "apple_pay_domain", "created": 1671514978, "domain_name": "e2c6-2601-281-8000-25c-d03d-1665-c5af-4e19.ngrok.io", "livemode": false }%
also, you need to register it with the Stripe-account header too
I ran curl https://api.stripe.com/v1/apple_pay/domains \ -u sk_test_: \ -H "Stripe-Account:acct_1LT8QGQo4ogIFLAC" \ -d domain_name="https://e2c6-2601-281-8000-25c-d03d-1665-c5af-4e19.ngrok.io"
sk_test_ -> this is the test key
and are you using your platform's secret key?
np, it's pretty confusing i think
Where do I find my platform's live secret key? In dashboard?
so that same link i gave you previously to get your secret key, but in the upper right hand corner, there's a toggle for live/test mode
i found it, it'll be the sk_live key right?
yep, that's right
it looks like it's obscured, how do i view the full one?
nope clicking doesn't reveal. is it a permissions issue?
on the right the triple dot screen has option to roll key...not sure what that it
hrm, let me check mine
is*
ah I see
you don't want to do that by accident in live mode
gotcha
i think what you can do instead
is to try creating a restricted key
give yourself read write permissions for everything for that restricted key
then try using that restricted key to register your domain in live mode
but i'm not sure if you have access to create one too
I can't change anything on backend, would I need to create another connect test account or modify anything else ?
I can create one
ah, then go ahead and create on restricted key and see if you can use it to register for a domain
okay will do
Can only select read or write, I'm guessing write?
And read where possible?
select write everything where possible
"error": {
"message": "The account acct_1LT8QGQo4ogIFLAC was a test account created with a testmode key, and therefore can only be used with testmode keys.",
"type": "invalid_request_error"
}
}```
yup
gimme a while to try and hunt down one of my own test accounts to try
Hi @tall jay can you try creating a connected account in live mode? so that you can use live-mode secret key to register an Apple Pay domain for it.
on a side note : i also encountered the same problem - hence try what jack suggested ^
i should be able to get the live key tomorrow for the account, its saved somewhere