---
page_source: https://juspay.io/in/docs/payment-page-enterprise/react-native/additional-features/amazonpay-s2s-tokenised-flow
page_title: AmazonPay S2S Tokenised Flow
---


# AmazonPay S2S Tokenised Flow




### **Prerequisites** 




### Step 1 Substep


All prerequisites required for Amazonpay commercial shall be completed by merchant. 

* Account creation with Amazon Pay
* Configure the credentials provided by Amazonpay on Juspay Dashboard and set the direct debit flag as true
* Merchant’s App name and SHA256 key has to be whitelisted at Amazonpay end
* The API key generated for the new secure profile created at Amazonpay has to be whitelisted at Amazonpay end.
* Contact your Juspay integration SPoC to get Amazonpay SDK added as a feature for your client ID at Juspay end.
* Configure Juspay’s set of callback URLs at Amazonpay’s end for the Seller ID
* Configure Juspay webhooks - this is critical to get real time transaction status from Amazonpay.
* Minimum SDK Version - Android version shall be equal to or greater than **2.2.1 (for SuperSDK)**
* Minimum SDK Version -  iOS version shall be equal to or greater than **2.1.23**




### **Dependencies - Android** 




### Step 2 Substep


In case of Android, Amazon’s dependencies are added by Juspay’s HyperSDK plugin build-time and nothing needs to be added explicitly.




### **Dependencies - iOS** 




### Step 3 Substep


SDK dependencies for Amzonpay can be added by the following pod:


#### Podfile Code Snippet:

```podfile
pod 'HyperAPay', '2.1.23'
```


> **Note**
> Ensure that the **HyperAPay**  version you are using here **should be same as your HyperSDK version** 




Ensure the following things are done:

* Add the following properties in your app's Info.plist file:
  
  
  #### info.plist Code Snippet:
  
  ```info.plist
  <key>CFBundleURLTypes</key>
  <array>
      <dict>
          <key>CFBundleURLName</key>
          <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
          <key>CFBundleURLSchemes</key>
          <array>
              <string>juspay-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
              <string>amzn-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
          </array>
      </dict>
  </array>
  ```
* Add your AmazonPay API key with the key name **APIKey**  in the plist file.
* Add the following code in the AppDelegate's **application:openurl:options**  function if the project is not using SceneDelegate:
  
  
  #### Swift Code Snippet:
  
  ```swift
  let juspayRegex = try? NSRegularExpression(pattern: "amzn-.*|juspay-.*", options: [])
  if (juspayRegex?.numberOfMatches(in: url.absoluteString, options: [], range: NSRange(location: 0, length: url.absoluteString.count)) ?? 0) > 0 {
      return HyperServices.handleRedirectURL(url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String ?? "")
  }
  ```
  
  #### Objective-C Code Snippet:
  
  ```objective-c
  NSRegularExpression *juspayRegex = [NSRegularExpression regularExpressionWithPattern:@"amzn-.*|juspay-.*" options:0 error:nil];
  if ([juspayRegex numberOfMatchesInString:[url absoluteString] options:0 range:NSMakeRange(0, [[url absoluteString] length])] > 0) {
      return [HyperServices handleRedirectURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
  }
  ```
* For the project that is using SceneDelegate, add the following code in SceneDelegate’s **scene:openURLContexts:**  function:
  
  
  #### Swift Code Snippet:
  
  ```swift
  func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
      if let URLContext = URLContexts.first {
          if URLContext.url.absoluteString.contains("juspay-") || URLContext.url.absoluteString.contains("amzn-") {
              HyperServices.handleRedirectURL(URLContext.url, sourceApplication: URLContext.options.sourceApplication ?? "")
          }
      }
  }
  ```
  
  #### Objective-C Code Snippet:
  
  ```objective-c
  - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
      UIOpenURLContext *URLContext = [URLContexts allObjects].firstObject;
      if (URLContext && URLContext.URL && ([URLContext.URL.absoluteString containsString:@"juspay-"] || [URLContext.URL.absoluteString containsString:@"amzn-"])) {
          [HyperServices handleRedirectURL:URLContext.URL sourceApplication:URLContext.options.sourceApplication];
      }
  }
  ```




### Step 4 Adding of APIKey.txt file in Android and iOS


Please follow the below steps to obtain the APIKey from the Amazon Dashboard and add in your project files. 

[https://amazonpay.s3.us-west-2.amazonaws.com/HardendSDK/Register+for+Login+with+Amazon.pdf](https://amazonpay.s3.us-west-2.amazonaws.com/HardendSDK/Register+for+Login+with+Amazon.pdf)




### Step 5 Webhook Configuration on Amazon Dashboard


Webhooks are required to be configured on Amazon Dashboard in order to obtain the real time transactions status. 

Sandbox URL: [https://sandbox.juspay.in/v2/pay/webhooks/:mid/amazonpay](https://sandbox.juspay.in/v2/pay/webhooks/:mid/amazonpay)

Production URL: [https://api.juspay.in/v2/pay/webhooks/:mid/amazonpay](https://api.juspay.in/v2/pay/webhooks/:mid/amazonpay)




### Step 6  Callback URLs  


These below are the set of callback URL’s of Juspay that needs to be whitelisted at Amazon End. In order to comeplete the process, you would need the below mentioned details.  

1. Appname
2. Package name
3. Juspay MID 
   
   Kindly replace the fields in the below URLs. Kindly confirm with your Juspay POC before sharing with Amazon.

Sandbox

* [https://sandbox.juspay.in/v2/pay/response-amazonpay/:mid](https://sandbox.juspay.in/v2/pay/response-amazonpay/:mid)
* [https://sandbox.juspay.in/v3/pay/response-amazonpay/:mid](https://sandbox.juspay.in/v3/pay/response-amazonpay/:mid)
* [https://sandbox.juspay.in/pay/response-amazonpay/:mid](https://sandbox.juspay.in/pay/response-amazonpay/:mid)
* https://sandbox.juspay.in/pay/sdk-response/apps/<packagename>?app_name=<Appname>
* juspay-<package name>://[customtab.juspay.in/<package](http://customtab.juspay.in/%3Cpackage)name>
* amzn://[amazonpay.amazon.in/<package](http://amazonpay.amazon.in/%3Cpackage)name>
* amzn-com.<package name>
* amzn-<bundleidentifier>://pwa (This is required for iOS)

Production 

* [https://api.juspay.in/v2/pay/response-amazonpay/:mid](https://api.juspay.in/v2/pay/response-amazonpay/:mid)
* [https://api.juspay.in/v3/pay/response-amazonpay/:mid](https://api.juspay.in/v3/pay/response-amazonpay/:mid)
* [https://api.juspay.in/pay/response-amazonpay/:mid](https://api.juspay.in/pay/response-amazonpay/:mid)
* [https://api.juspay.in/pay/sdk-response/apps/<package](https://api.juspay.in/pay/sdk-response/apps/%3Cpackage)name>?app_name=<App name>
* juspay-<package name>://[customtab.juspay.in/<package](http://customtab.juspay.in/%3Cpackage)name>
* amzn://[amazonpay.amazon.in/<package](http://amazonpay.amazon.in/%3Cpackage)name>
* amzn-com.<package name>
* amzn-<bundleidentifier>://pwa (This is required for iOS)




### Step 1.1. User Experience


* **Link transaction**  : The user will be redirected to Amazonpay login page on Chrome custom tab/ CCT. The user shall login into Amazon Pay account and successfully link Amazon Pay wallet and land on the payment page
* **Pay (with sufficient balance)** : The Amazonpay wallet balance will be displayed to the user on the payment page. If the funds are sufficient to complete the transaction, the amount will be automatically debited
* **Pay (with insufficient balance)** : If the funds are insufficient to complete the transaction, the user will be redirected to Amazonpay page, where he can pay the balance amount using a payment instrument of choice

