mdmb
mdmb

Reputation: 5283

Stripe Connect – enable Apple Pay?

I'm trying to make Stripe Connect accounts accept payments in my app with the use of PaymentElement. So far the payments are going through with the regular credit card input, but now I want to enable Apple Pay.

So, I added my domain name to my main Stripe account configuration. It seems that is not enough, so I added the domain name also for the particular Connect account using their API:

await stripe.applePayDomains.create(
  { domain_name: 'my_domain_here.com' },
  { stripeAccount: 'stripe_connect_account_id_here' },
);

When I now access my PaymentElement component Safari on macOS with the support of Apple Pay (tested and working on other sites), the ApplePay options does not appear and I get a console warning of:

Either you do not have a card saved to your Wallet or the current domain (my_domain_here.com) or stripeAccount parameter (stripe_connect_account_id_here) is not registered for Apple Pay.

The card is in my Wallet, the domain is visible when listing it them for the account with stripe.applePayDomains.list({ stripeAccount: 'stripe_connect_account_id_here' }).

When I try to access it on my iOS device, the ApplePay option appears, yet triggering stripe.confirmPayment make the iOS payment drawer appear for ~1 second, just to disappear right away.

What am I missing here?

Upvotes: 7

Views: 3172

Answers (3)

Muhammad Tanweer
Muhammad Tanweer

Reputation: 912

I was having issue adding domain verification for apple pay to my connect account. For connect account, you do need to add domain verification to connect account too. The mistake that I was doing was that I was passing https://mysubdomain.example.com whereas stripe accepts just mysubdomain.example.com format. Although in the error I was getting it was just saying We had trouble validating your domain. So the error didn't point correctly but after hit and trial thats what I found. Hope it helps someone

Upvotes: 1

Michael Kubler
Michael Kubler

Reputation: 81

To add more to the answer from @mdmb it's not just Test mode, but because we are using connected accounts we need to create the Apple Domain verification in the connected account.

I contacted Stripe and they suggested I create the Apple Domain in code as the connected account as per https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#verifying-your-domain-with-apple-pay

Their response to me was:


There are a few things to fix here to get Apple Pay working:

1/ The Connect account has to be created in live mode, the one above is in test mode. So you need to create a new Connect account in live mode with live mode details.

2/ Step one is needed because you need to add your Apple Pay domain to the Connect account in live mode as well, which requires a live mode account in the first place.

The important part here is you need to add the Apple Pay domain using the Stripe-Account header + Platform secret key, as shown here: https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-using-with-connect.

Once you do those two things, you can still initialize Stripe.js with your platform's test mode publishable key and stripeAccount parameter, and Apple Pay will work in that it will only create test mode tokens, if that is something you may be looking to do.


So they suggest the key part of doing (in PHP):

\Stripe\Stripe::setApiKey("sk_live_••••••••••••••••••••••••");

\Stripe\ApplePayDomain::create([
  'domain_name' => 'example.com',
]);

However if you are using the more up to date Client way then you'll want to do something like:

$stripeClient = new \Stripe\StripeClient(['api_key' => $this->stripeApiKey,'stripe_account' => $connectedAccount->stripeAccountId]);
$stripeClient->applePayDomains->create([
   'domain_name' => $domainName,
]);

Tested it and this works. It seems to take about 1.5s to do the domain verification, then seems basically instant later.

Cheers!

Upvotes: 1

mdmb
mdmb

Reputation: 5283

So, as of the day of this post, this is indeed a default behaviour inside the test mode. All works fine inside the production environment.

I'm not entirely sure if Stripe will (or even can) fix this.

Upvotes: 1

Related Questions