# Apple Pay web sdk with auth + deferred capture with different amount

**URL:** <https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560>\
**Category:** Questions\
**Tags:** payments-api, web-payments-sdk\
**Created:** [February 13, 2023, 5:55pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560 "2023-02-13T17:55:14Z")\
**Posts on this page:** 16\
**Page:** 6

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 2, 2024, 11:28am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/103 "2024-04-02T11:28:06Z")

</div>

Hi @Bryan-Square

Here is the location\_id which we are using LR4NE71KHRBY6.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 2, 2024, 4:17pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/104 "2024-04-02T16:17:53Z")

</div>

Are the other payment methods working in sandbox? 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 3, 2024, 12:20pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/105 "2024-04-03T12:20:55Z")

</div>

Hi @Bryan-Square

In our APP we are using only GPay, and this works in sandbox only if the Square Application ID has been initialised from the `AndroidManifest.xml` file

```auto
<meta-data
  android:name="sqip.SQUARE_APPLICATION_ID"
  android:value="CA_APPLICATION_ID"/>

```

If the same is initialised at the runtime, the solution provided by your team earlier in this conversation is not working as expected.

```auto
InAppPaymentsSdk.squareApplicationId = USD_APP_ID

```

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 3, 2024, 5:44pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/106 "2024-04-03T17:44:53Z")

</div>

Could you tell use how it doesn’t “work as expected?” According to the team it _should_ be that the application id is the application id, however it got set. 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 4, 2024, 2:51pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/107 "2024-04-04T14:51:40Z")

</div>

Hi @Bryan-Square

**Problem Statement :-**  
Currently our App has Google Payments enabled for US location and we want to roll out GPay in Canada region, hence we have two Square Accounts. Now for implementing the transaction smoothly between the two regions we need to configure the Application ID dynamically at runtime and not from the `AndroidManifest.xml` file using `meta-data` tags as the manifest is compiled into the APK and we have Single APK for both the locations.

Location ID Used - **LR4NE71KHRBY6**

**Solution Provided By Square Team :-**  
You can initialize the In-App Payments SDK by doing `InAppPaymentsSdk.squareApplicationId = USD_APP_ID`.

**Solution implemented :-**

1. We have implemented the above solution in the sandbox environment for both Canada and US region at runtime using below code.

```auto
if ("US" == value) {
  squareApplicationId = US_APPLICATION_ID
} else if ("CA" == value) {
  squareApplicationId = CA_APPLICATION_ID
}

// Initialize the Square In-App Payments SDK with the appropriate application ID
InAppPaymentsSdk.squareApplicationId = squareApplicationId

```

**Here is the error, which we receive after clicking on the GPay button and before we create a nonce. Hence the token is not generated.**

 ![canada_gpay](https://global.discourse-cdn.com/square/original/2X/3/3e3b7e28c96204ecbf47ff1298339e196722b705.png)

1. We confirmed that the same Canada sandbox credential when initialised from the `AndroidManifest.xml` file, as per the current SDK documentation, we were able to launch Google Pay screen and the payment was processed successfully.

```auto
<meta-data
  android:name="sqip.SQUARE_APPLICATION_ID"
  android:value="CA_APPLICATION_ID"/>

```

Can you please let us know are there any other steps to be implemented after this code `InAppPaymentsSdk.squareApplicationId = squareApplicationId` to make it work.

Or are there any other ways of achieving multiple Square application Id at runtime in single APK.

Let me know if any other details are required.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 4, 2024, 4:18pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/108 "2024-04-04T16:18:04Z")

</div>

If you have Google Pay enabled on the US account then it will work in all supported regions including Canada. Is the reason you have two Square accounts is to charge in CAD and USD? 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 7, 2024, 8:30am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/109 "2024-04-07T08:30:47Z")

</div>

Yes, parking is our primary focus, and we have Canadian locations that require transactions in CAD currency. The decision to maintain separate accounts for the USA and Canada stems from business considerations. Our main query pertains to handling two distinct accounts within our Android app using your SDKs.

As a reference, we successfully implemented dynamic initialization of the SQUARE\_APPLICATION\_ID based on location in our iOS app. We seek a similar capability for our Android app without relying on the AndroidManifest.xml tag.

However, despite trying all the solutions provided in the forum, none of them seem to be effective. We have shared our results, including error screenshots and location IDs, but have received irrelevant responses for the past 24 days.

**All we need is to initialize the SQUARE\_APPLICATION\_ID dynamically based on the location in the Android app so that we can charge users in their respective currencies using Google Pay with two separate Square accounts.**

Please reply ASAP

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 9, 2024, 9:48am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/110 "2024-04-09T09:48:40Z")

</div>

@Bryan-Square Could you please provide your response to the post?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 9, 2024, 5:00pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/111 "2024-04-09T17:00:29Z")

</div>

I’ve reached out to the team and am waiting on there reply. Once I hear from the team I’ll provide an update. 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 15, 2024, 5:43am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/112 "2024-04-15T05:43:53Z")

</div>

@Bryan-Square Do you have any update from your team?

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 17, 2024, 9:38am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/113 "2024-04-17T09:38:32Z")

</div>

@Bryan-Square Could you please let us know if you can arrange a call with your development team so that we can finalize this discussion?

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 17, 2024, 4:27pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/114 "2024-04-17T16:27:55Z")

</div>

What isn’t working based on what the team’s recommended solution? Are you not able to programmatically set the application ID instead of XML to initialize the In-App Payments SDK to country specific application ID for tokenizing the the card? 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 18, 2024, 1:14pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/115 "2024-04-18T13:14:46Z")

</div>

@Bryan-Square  
Are you not able to programmatically set the application ID instead of XML to initialize the In-App Payments SDK to country specific application ID for tokenizing the the card?  
==\> YES, thats correct. When we try your recommended solution. After we click on Google Pay button, we end up with following screen. Please read last 35 days comments for better understanding the issue.

 ![image](https://global.discourse-cdn.com/square/original/2X/9/9f44fc99f90c001ff75123670a747e9afffd0f81.png)

Parking is our primary focus, and we have Canadian locations that require transactions in CAD currency. The decision to maintain separate accounts for the USA and Canada stems from business considerations. Our main query pertains to handling two distinct accounts within our Android app using your SDKs.

As a reference, we successfully implemented dynamic initialization of the SQUARE\_APPLICATION\_ID based on location in our iOS app. We seek a similar capability for our Android app without relying on the AndroidManifest.xml tag.

However, despite trying all the solutions provided in the forum, none of them seem to be effective. We have shared our results, including error screenshots and location IDs, but have received irrelevant responses for the past 35 days.

**All we need is to initialize the SQUARE\_APPLICATION\_ID dynamically based on the location in the Android app so that we can charge users in their respective currencies using only Google Pay with two separate Square accounts.**

PLEASE SHARE THE SOLUTION or SOURCE CODE WHICH IS WORKING FOR YOUR TEAM. WE WOULD LIKE TO TRY THAT APP RIGHT AWAY. THIS WOULD BE A GREAT HELP!!!

Please reply ASAP

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [April 18, 2024, 4:22pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/116 "2024-04-18T16:22:45Z")

</div>

Is it just Google Pay that’s failing. Is the regular card input when initialized this way working? 🙂

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 18, 2024, 5:24pm UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/117 "2024-04-18T17:24:55Z")

</div>

We are not considering card payment in our usecase. We only use Google pay.  
Also we are not sure the card payment whether works or not.

---

<div class="post-metadata">

**Author:** ![anveshtokala](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anveshtokala](https://developer.squareup.com/forums/u/anveshtokala)\
**Post date:** [April 23, 2024, 10:01am UTC](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560/118 "2024-04-23T10:01:21Z")

</div>

@Bryan-Square Could you please let us know if you can arrange a call with your development team so that we can finalize this discussion?

[Previous page](https://developer.squareup.com/forums/t/apple-pay-web-sdk-with-auth-deferred-capture-with-different-amount/8560.md?page=5)
