#Srujan

1 messages · Page 1 of 1 (latest)

broken doveBOT
smoky storm
#

hello! can you share your test site?

tall jay
#

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

smoky storm
#

yep, can you share your submit handler code also?

tall jay
#

Sure

smoky storm
#

gimme a while to scan through it

tall jay
#

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

smoky storm
#

is the issue that you see a developer error?

tall jay
#

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

smoky storm
#

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.
tall jay
#

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

smoky storm
#

so are you saying you're no longer receiving that error?

tall jay
#

I don't see that error but was getting it a few hours ago...

#

That link is what I'm testing on

smoky storm
#

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

tall jay
#

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?

smoky storm
#

yep, that should resolve the issue, lets try and see

tall jay
#

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?

smoky storm
#

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

tall jay
#

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

#

Yeah the payment element doesn't render because I think the authentication issue

smoky storm
#

yeah, you need to load the PaymentIntent created with the same stripe account

tall jay
#

Yup

smoky storm
#

as a workaround, do you think you could try manually creating one with curl and the stripe account header then hardcoding it locally?

tall jay
#

Do you mean creating a paymentintent?

smoky storm
#

yep

tall jay
#

Yeah I can try for sure

#

Is curl just a command I would type into terminal haven't done that in a while

smoky storm
#

onesec, let me pull the command

tall jay
#

I'd have to find the sk_test key

#

Where does the stripe account header go?

smoky storm
#
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_
tall jay
#

ah nice

#

Where can i find the sk_test key is it somewhere in the dashboard?

smoky storm
#

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

tall jay
#

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?

smoky storm
#

in the terminal

tall jay
#

just in my terminal?

#

Oh okay sweet thanks

#

Do I change the payment_method_type to google_pay?

smoky storm
#

nope, card is correct

tall jay
#

okay sweet

smoky storm
#

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

tall jay
#

This is what I tried, just hard coded the client Secret but I'm still getting 404s

smoky storm
#

don't paste your secret key here even if it's for testmode

tall jay
#

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```
smoky storm
#

hrm, onesec, let me test

#

oh my bad, remove the space here

  -H Stripe-Account:acct_
tall jay
#

ah okay

smoky storm
#

you're no longer getting curl: (6) Could not resolve host: acct_1LT8QGQo4ogIFLAC right?

tall jay
#

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?

smoky storm
#

it's just one of those weird and strange quirks i'm afraid

tall jay
#

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!

smoky storm
#

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

tall jay
#

Oh i see...

#

Yeah we have an IOS app that I believe depends on that

smoky storm
#

also, i wanted to highlight some other points about Apple Pay

tall jay
#

Yes please

#

Could I create a standard connected account in test mode that would satisfy both requirements?

smoky storm
#

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

#

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.
tall jay
#

ah yeah that's the agenda tomorrow

smoky storm
#

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

tall jay
#

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.?

smoky storm
#

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

tall jay
#

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.?

smoky storm
#

specifically this line

You must use your platform’s live secret key to register the domains – don’t add domains in test mode.
tall jay
#

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?

smoky storm
#

yeah, you can do it using cURL too

#

hrm, i guess yes, you can think of it as it's permanent

tall jay
#

okay sweet I was waiting on backend team to do this but I'm gonna go ahead and take care of that now

smoky storm
#

you're going to need to re-register your domain everytime your ngrok tunnel domain changes 😅

tall jay
#

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

smoky storm
#

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

daring atlas
#

Hi @tall jay I'm taking over. Let me know if you have any follow-up questions.

tall jay
#

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

tall jay
#

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

smoky storm
#

you didn't register it with your live key

tall jay
#

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

#

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 }%

smoky storm
#

also, you need to register it with the Stripe-account header too

tall jay
#

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"

smoky storm
#

sk_test_ -> this is the test key

tall jay
#

Yup

#

I just took it out

smoky storm
#

and are you using your platform's secret key?

tall jay
#

Oh wait

#

That's what you were talking about

#

Sorry

smoky storm
#

np, it's pretty confusing i think

tall jay
#

Where do I find my platform's live secret key? In dashboard?

smoky storm
#

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

tall jay
#

Which link?

#

oh the api key link

smoky storm
#

or you can just remove the test from the url

tall jay
#

i found it, it'll be the sk_live key right?

smoky storm
#

yep, that's right

tall jay
#

it looks like it's obscured, how do i view the full one?

smoky storm
#

click on the obscured portion

#

i think it should reveal?

tall jay
#

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

smoky storm
#

hrm, let me check mine

tall jay
#

is*

smoky storm
#

nonono, don't roll the key

#

rolling the key means to change the secret key

tall jay
#

ah I see

smoky storm
#

you don't want to do that by accident in live mode

tall jay
#

gotcha

smoky storm
#

you may break your prod code 😅

#

hrm, i guess you may not have access

tall jay
#

definitely not clicking that then 🤭

#

damn

#

okay

smoky storm
#

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

tall jay
#

I can't change anything on backend, would I need to create another connect test account or modify anything else ?

#

I can create one

smoky storm
#

ah, then go ahead and create on restricted key and see if you can use it to register for a domain

tall jay
#

okay will do

#

Can only select read or write, I'm guessing write?

#

And read where possible?

smoky storm
#

select write everything where possible

tall jay
#
  "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"
  }
}```
smoky storm
#

hrm 🤔

#

so that was when you tried to register the domain?

tall jay
#

yup

smoky storm
#

gimme a while to try and hunt down one of my own test accounts to try

daring atlas
#

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.

smoky storm
#

on a side note : i also encountered the same problem - hence try what jack suggested ^

tall jay
#

i should be able to get the live key tomorrow for the account, its saved somewhere