Get Instruments API
Method: GET
Path: <endpoint>/v1/payments/instruments
Description: This API retrieves one or more payment instruments based on the request. It enables the retrieval of specific details which is crucial for displaying user payment details on your payments UI.
Request Parameters
Parameter | Type | Description |
---|---|---|
merchantId | String | Your merchant ID with Amazon Pay |
accessToken | String | Access token fetched for the user |
instrumentTypes | String | Types of user’s payment instruments with Amazon Pay. Allowed value - AmazonPayLater |
amount | String | Transaction amount that customer wants to pay. You can only send up to 2 digits after decimal point. |
Instrument Types
Value | Description |
---|---|
AmazonPayLater | Fetches the credit limit for AmazonPayLater and the eligibility of the user. If the customer is not eligible, we will provide the ineligibility reason. |
Request Sample
https://{{endpoint}}/v1/payments/instruments?merchantId=A28RUURDCTQXU1&accessToken=Atza|IgEBdsfsdfdsf&instrumentTypes=AmazonPayLater&amount=1000
Sample Response
{
"amazonPayLater": {
"enabled": true,
"priority": 1,
"availableCredit": "1000.00",
"keyFactStatementUrl": "https://amazonpay.amazon.in/render_kfs?authToken=Atza|IgEBdf&payload=ABCDEFGHIJKL&iv=abcdef"
}
}
Sample Code
Sample Request (Curl)
curl --location 'https://amazonpay.amazon.in/v1/payments/instruments?merchantId=A28RUURDCTQXU1&accessToken=Atza|IgEBdsfsdfdsf&instrumentTypes=AmazonPayLater&amount=10.00' \
--header 'x-amz-date: 20220311T135700Z' \
--header 'x-amz-user-ip: 52.95.75.13' \
--header 'x-amz-user-agent: Postman' \
--header 'x-amz-client-id: AZ4WQCLDT2DF0' \
--header 'x-amz-expires: 900' \
--header 'x-amz-algorithm: AWS4-HMAC-SHA384' \
--header 'x-amz-source: Browser' \
--header 'Authorization: AMZ+f57bbc68-fa6a-4c5e-a281-d39db51a26c6:98htMuBl6MKdfJMlxVRTjvq0T3rMYaM'
Sample Response (Curl)
{
"amazonPayLater": {
"enabled": true,
"priority": 1,
"availableCredit": "1000.00",
"keyFactStatementUrl": "https://amazonpay.amazon.in/render_kfs?authToken=Atza|IgEBdf&payload=ABCDEFGHIJKL&iv=abcdef"
}
}
/* Create HTTP request Object */
OkHttpClient client = new OkHttpClient().newBuilder().build();
/* API headers */
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
/* Querry parameters */
Request request = new Request.Builder()
.url("https://amazonpay.amazon.in/v1/payments/instruments?merchantId=A28RUURDCTQXU1&accessToken=Atza|IgEBdsfsdfdsf&instrumentTypes=AmazonPayLater&amount=10.00")
.method("GET", body)
.addHeader("x-amz-date", "20220311T135700Z")
.addHeader("x-amz-user-ip", "52.95.75.13")
.addHeader("x-amz-user-agent", "Postman")
.addHeader("x-amz-client-id", "AZ4WQCLDT2DF0")
.addHeader("x-amz-expires", "900")
.addHeader("x-amz-algorithm", "AWS4-HMAC-SHA384")
.addHeader("x-amz-source", "Browser")
.addHeader("Authorization", "AMZ+f57bbc68-fa6a-4c5e-a281-XXXXXX:98htMuBl6MKdfJMlxVRTjvq0T3rMYaMnElO_ekbXMJqohP9jOHfHcfmPU0drNtua")
.build();
/* Capture Response */
Response response = client.newCall(request).execute();
var request = require('request');
/* Prepearing API request */
var options = { 'method': 'GET', 'url': 'https://amazonpay.amazon.in/v1/payments/instruments?merchantId=A28RUURDCTQXU1&accessToken=Atza|IgEBdsfsdfdsf&instrumentTypes=AmazonPayLater&amount=10.00',
/* Adding API headers */
'headers': { 'x-amz-date': '20220311T135700Z', 'x-amz-user-ip': '52.95.75.13', 'x-amz-user-agent': 'Postman', 'x-amz-client-id': 'AZ4WQCLDT2DF0', 'x-amz-expires': '900', 'x-amz-algorithm': 'AWS4-HMAC-SHA384', 'x-amz-source': 'Browser', 'Authorization': 'AMZ+f57bbc68-fa6a-4c5e-a281-XXXXXXX:98htMuBl6MKdfJMlxVRTjvq0T3rMYaMnElO_ekbXMJqohP9jOHfHcfmPU0drNtua' } };
/* Capture Response */
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
$client = new Client();
/* API headers */
$headers = [ 'x-amz-date' => '20220311T135700Z', 'x-amz-user-ip' => '52.95.75.13', 'x-amz-user-agent' => 'Postman', 'x-amz-client-id' => 'AZ4WQCLDT2DF0', 'x-amz-expires' => '900', 'x-amz-algorithm' => 'AWS4-HMAC-SHA384', 'x-amz-source' => 'Browser', 'Authorization' => 'AMZ+f57bbc68-fa6a-4c5e-a281-XXXXXXXX:98htMuBl6MKdfJMlxVRTjvq0T3rMYaMnElO_ekbXMJqohP9jOHfHcfmPU0drNtua' ];
/* API request */
$request = new Request('GET', 'https://amazonpay.amazon.in/v1/payments/instruments?merchantId=AZ4WQCLDT2DF0&accessToken=Atza|YgF-5lV&instrumentTypes=AmazonPayLater&amount=1000', $headers);
/* Capture Response */
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Common Errors
Error | Resolution |
---|---|
InvalidAccessToken | This error indicates that the access token has turned stale and is no longer valid or doesn't have the right permissions. Access tokens turn stale 60 minutes after they are requested. To resolve, request a new access token. If the error persists, ask the user to re-link the account. |
Missing Amount in API request | This error message indicates that there is no amount specified in the API request. Ensure that the right amount is specified. |
Signature error | To resolve errors related to signatures:
|