Skip to content

Commit 73f0bab

Browse files
author
Shangamesh T
committed
Amazon Pay API SDK (.NET) 2.5.1
1 parent d9245f6 commit 73f0bab

File tree

7 files changed

+31
-38
lines changed

7 files changed

+31
-38
lines changed

Amazon.Pay.API.SDK.Tests/CreateStringToSignTest.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void SimpleGet()
3535
var uri = new Uri("http://pay-api.amazon.eu/");
3636
var apiRequest = new ApiRequest(uri, method);
3737
var expectedCanonicalRequest = "GET\n/\n\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
38-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n13fdf6db844bdfb9e9c0e27a4251ca04e60c29ca2132249c5dd1cb09c26e22f5";
38+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n13fdf6db844bdfb9e9c0e27a4251ca04e60c29ca2132249c5dd1cb09c26e22f5";
3939

4040
// act
4141
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -54,7 +54,7 @@ public void GetWithTooManySlashesInUri()
5454
var uri = new Uri("http://pay-api.amazon.eu///foo//");
5555
var apiRequest = new ApiRequest(uri, method);
5656
var expectedCanonicalRequest = "GET\n/foo/\n\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
57-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\nd8e13e1857bc9b5056cc8ccb2699812faa2c68960e00483b1390fdaf4a991cc4";
57+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\nd8e13e1857bc9b5056cc8ccb2699812faa2c68960e00483b1390fdaf4a991cc4";
5858

5959
// act
6060
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -73,7 +73,7 @@ public void GetWithUnreservedCharacters()
7373
var uri = new Uri("http://pay-api.amazon.eu/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
7474
var apiRequest = new ApiRequest(uri, method);
7575
var expectedCanonicalRequest = "GET\n/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
76-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n585e034d38ed3d64c0cd77a9f357a4b4a0fc093eebe06f4b06f66845e3543038";
76+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n585e034d38ed3d64c0cd77a9f357a4b4a0fc093eebe06f4b06f66845e3543038";
7777

7878
// act
7979
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -94,7 +94,7 @@ public void GetWithHighAsciiCharacterInParameterString()
9494
apiRequest.QueryParameters.Add("\u1234", new List<string>() { "bar" });
9595

9696
var expectedCanonicalRequest = "GET\n/\n%E1%88%B4=bar\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
97-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\nf0597d2fdcf97baf28002461796e916a74e35073b44042296d2ed45bacf6ecf0";
97+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\nf0597d2fdcf97baf28002461796e916a74e35073b44042296d2ed45bacf6ecf0";
9898

9999
// act
100100
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -114,7 +114,7 @@ public void SimplePost()
114114
var uri = new Uri("http://pay-api.amazon.eu/");
115115
var apiRequest = new ApiRequest(uri, method);
116116
var expectedCanonicalRequest = "POST\n/\n\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
117-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n322307b5dae22c3d59350c3de9202a488f337f674c8f430b186282008264bd2b";
117+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n322307b5dae22c3d59350c3de9202a488f337f674c8f430b186282008264bd2b";
118118

119119
// act
120120
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -135,7 +135,7 @@ public void PostWithQueryParameter()
135135
var apiRequest = new ApiRequest(uri, method);
136136
apiRequest.QueryParameters.Add("foo", new List<string>() { "bar" });
137137
var expectedCanonicalRequest = "POST\n/\nfoo=bar\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
138-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n9d61b5abddbfdcaf7810a8e83dfffe0a5d5f272d2676c0550d974d5383e94cd5";
138+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n9d61b5abddbfdcaf7810a8e83dfffe0a5d5f272d2676c0550d974d5383e94cd5";
139139

140140
// act
141141
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -156,7 +156,7 @@ public void GetWithMultipleQueryValuesInSingleParameter()
156156
var apiRequest = new ApiRequest(uri, method);
157157
apiRequest.QueryParameters.Add("foo", new List<string>() { "b", "a" });
158158
var expectedCanonicalRequest = "GET\n/\nfoo=a&foo=b\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
159-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n937de37fb8aed8af4214c373580c72f40c525202d1975df6836ba6ed0062b902";
159+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n937de37fb8aed8af4214c373580c72f40c525202d1975df6836ba6ed0062b902";
160160

161161
// act
162162
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -178,7 +178,7 @@ public void GetWithMultipleQueryParameters()
178178
apiRequest.QueryParameters.Add("a", new List<string>() { "foo" });
179179
apiRequest.QueryParameters.Add("b", new List<string>() { "foo" });
180180
var expectedCanonicalRequest = "GET\n/\na=foo&b=foo\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
181-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n457de2535eedbd6ef25f5c8ec4653ee885b99838d722189928f4fdf8d3c3ef4f";
181+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n457de2535eedbd6ef25f5c8ec4653ee885b99838d722189928f4fdf8d3c3ef4f";
182182

183183
// act
184184
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -201,7 +201,7 @@ public void GetWithMultipleQueryParametersSorted()
201201
apiRequest.QueryParameters.Add("A.10", new List<string>() { "foo" });
202202
apiRequest.QueryParameters.Add("A.2", new List<string>() { "foo" });
203203
var expectedCanonicalRequest = "GET\n/\nA.1=foo&A.10=foo&A.2=foo\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
204-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n43ae5290e6742d30e3822b62b6d759afedafbe01534f778175c336b455d632e7";
204+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n43ae5290e6742d30e3822b62b6d759afedafbe01534f778175c336b455d632e7";
205205

206206
// act
207207
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -222,7 +222,7 @@ public void GetWithMultipleQueryValuesInSingleParameterSorted()
222222
var apiRequest = new ApiRequest(uri, method);
223223
apiRequest.QueryParameters.Add("foo", new List<string>() { "Zoo", "aha" });
224224
var expectedCanonicalRequest = "GET\n/\nfoo=Zoo&foo=aha\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
225-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n7a4d89bd832cb93f2102f66bc8d3a0bc5f224c0bb758eab261dcd34a8ed2f117";
225+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n7a4d89bd832cb93f2102f66bc8d3a0bc5f224c0bb758eab261dcd34a8ed2f117";
226226

227227
// act
228228
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -243,7 +243,7 @@ public void GetWithReservedCharactersInQueryParameter()
243243
var apiRequest = new ApiRequest(uri, method);
244244
apiRequest.QueryParameters.Add("-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", new List<string>() { "-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" });
245245
var expectedCanonicalRequest = "GET\n/\n-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
246-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\naa69ca06d93d9220f9aa16314d8556e18e1b0ae39802cd169bd3af6c08cd7164";
246+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\naa69ca06d93d9220f9aa16314d8556e18e1b0ae39802cd169bd3af6c08cd7164";
247247

248248
// act
249249
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -263,7 +263,7 @@ public void PostWithSpecialCharactersInQueryParameter()
263263
var apiRequest = new ApiRequest(uri, method);
264264
apiRequest.QueryParameters.Add("@#$%^&+=/,?><`\";:\\|][{} ", new List<string>() { "@#$%^&+=/,?><`\";:\\|][{} " });
265265
var expectedCanonicalRequest = "POST\n/\n%40%23%24%25%5E%26%2B%3D%2F%2C%3F%3E%3C%60%22%3B%3A%5C%7C%5D%5B%7B%7D%20=%40%23%24%25%5E%26%2B%3D%2F%2C%3F%3E%3C%60%22%3B%3A%5C%7C%5D%5B%7B%7D%20\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
266-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n50709f5220d06911feee2d6aa8bf8453c8517f44527c0912e62b905d26c7e08f";
266+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n50709f5220d06911feee2d6aa8bf8453c8517f44527c0912e62b905d26c7e08f";
267267

268268
// act
269269
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);
@@ -283,7 +283,7 @@ public void PostWithSpacesInQueryParameter()
283283
var apiRequest = new ApiRequest(uri, method);
284284
apiRequest.QueryParameters.Add("f oo", new List<string>() { "b ar" });
285285
var expectedCanonicalRequest = "POST\n/\nf%20oo=b%20ar\naccept:application/json\ncontent-type:application/json\nx-amz-pay-date:20180524T223710Z\nx-amz-pay-host:pay-api.amazon.eu\nx-amz-pay-region:eu\n\naccept;content-type;x-amz-pay-date;x-amz-pay-host;x-amz-pay-region\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
286-
var expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n79481e4e38a053f7be8bda701c0d302d39df18bf468578b133c3be8e93fea86a";
286+
var expectedStringToSign = "AMZN-PAY-RSASSA-PSS\n79481e4e38a053f7be8bda701c0d302d39df18bf468578b133c3be8e93fea86a";
287287

288288
// act
289289
string actualCanonicalRequest = signatureHelper.CreateCanonicalRequest(apiRequest, defaultHeaders);

Amazon.Pay.API.SDK.Tests/SignatureHelperTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void CreateStringToSignTest()
3838

3939
signatureHelper = new SignatureHelper(config, canonicalBuilder.Object);
4040
string actualStringTosign = signatureHelper.CreateStringToSign(canonicalRequest);
41-
string expectedStringToSign = Constants.AmazonSignatureAlgorithm + "\n" + "95b0d65e9efb9f0b9e8c2f3b77";
41+
string expectedStringToSign = "AMZN-PAY-RSASSA-PSS" + "\n" + "95b0d65e9efb9f0b9e8c2f3b77";
4242

4343
canonicalBuilder.VerifyAll();
4444
Assert.AreEqual(expectedStringToSign, actualStringTosign);
@@ -84,7 +84,7 @@ public void ButtonPayloadAsJsonResultsInExpectedSignatureString()
8484

8585
var stringToSign = signatureHelper.CreateStringToSign(payload);
8686

87-
Assert.AreEqual(Constants.AmazonSignatureAlgorithm + "\n8dec52d799607be40f82d5c8e7ecb6c171e6591c41b1111a576b16076c89381c", stringToSign);
87+
Assert.AreEqual("AMZN-PAY-RSASSA-PSS\n8dec52d799607be40f82d5c8e7ecb6c171e6591c41b1111a576b16076c89381c", stringToSign);
8888
}
8989

9090
[Test]
@@ -155,7 +155,7 @@ public void CanGenerateSignature()
155155
var result = helper.GenerateSignature(message);
156156
var sigBytes = Convert.FromBase64String(result);
157157

158-
PssSigner signer = new PssSigner(new RsaEngine(), new Sha256Digest(), Constants.SaltLength);
158+
PssSigner signer = new PssSigner(new RsaEngine(), new Sha256Digest(), 20);
159159
signer.Init(true, pub1);
160160
signer.BlockUpdate(bytesToSign, 0, bytesToSign.Length);
161161
var resultVerify = signer.VerifySignature(sigBytes);

Amazon.Pay.API.SDK/Amazon.Pay.API.SDK.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
5-
<Version>2.5.0</Version>
6-
<AssemblyVersion>2.5.0.0</AssemblyVersion>
5+
<Version>2.5.1</Version>
6+
<AssemblyVersion>2.5.1.0</AssemblyVersion>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
88
<Authors>Amazon Pay</Authors>
99
<Company>Amazon</Company>

Amazon.Pay.API.SDK/Constants.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ namespace Amazon.Pay.API
44
{
55
public class Constants
66
{
7-
public const string SdkVersion = "2.5.0.0";
7+
public const string SdkVersion = "2.5.1.0";
88
public const string SdkName = "amazon-pay-api-sdk-dotnet";
99
public const int ApiVersion = 2;
10-
public const int SaltLength = 32;
11-
public const string AmazonSignatureAlgorithm = "AMZN-PAY-RSASSA-PSS-V2";
10+
11+
public const string AmazonSignatureAlgorithm = "AMZN-PAY-RSASSA-PSS";
1212

1313
public static readonly Dictionary<string, int> serviceErrors = new Dictionary<string, int>() {
1414
{"Internal Server Error", 500},

Amazon.Pay.API.SDK/SignatureHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class SignatureHelper : ISignatureHelper
1717
{
1818
private readonly ApiConfiguration payConfiguration;
1919
private readonly string LineSeparator = "\n";
20+
private readonly int SaltLength = 20;
2021
private readonly CanonicalBuilder canonicalBuilder;
2122

2223
public SignatureHelper(ApiConfiguration payConfiguration, CanonicalBuilder canonicalBuilder)
@@ -159,7 +160,7 @@ public string GenerateSignature(string stringToSign)
159160
}
160161

161162
// initiate the signing object
162-
PssSigner pssSigner = new PssSigner(new RsaEngine(), new Sha256Digest(), Constants.SaltLength);
163+
PssSigner pssSigner = new PssSigner(new RsaEngine(), new Sha256Digest(), SaltLength);
163164
pssSigner.Init(true, new ParametersWithRandom(parameters, random));
164165
pssSigner.BlockUpdate(bytesToSign, 0, bytesToSign.Length);
165166

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### Version 2.5.1 - January 2022
2+
* Applied patch to address issues occurred in Version 2.5.0.
3+
**Please dont use Version 2.5.0**
4+
15
#### Version 2.5.0 - January 2022
26
* Updated "ExpirationTimestamp" property on ChargePermissionResponse to nullable
37
* Migrated signature generating algorithm from AMZN-PAY-RSASSA-PSS to AMZN-PAY-RSASSA-PSS-V2 & increased salt length from 20 to 32

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ This SDK is compatible with .NET Standard 2.0 (including .NET Core 2.0), as well
2626

2727
## SDK Installation
2828

29-
This SDK can be downloaded from NuGet [here](https://www.nuget.org/packages/Amazon.Pay.API.SDK) or GitHub [here](https://github.com/amzn/amazon-pay-api-sdk-dotnet/releases/download/2.5.0/Amazon.Pay.API.SDK.2.5.0.nupkg).
29+
This SDK can be downloaded from NuGet [here](https://www.nuget.org/packages/Amazon.Pay.API.SDK) or GitHub [here](https://github.com/amzn/amazon-pay-api-sdk-dotnet/releases/download/2.5.1/Amazon.Pay.API.SDK.2.5.1.nupkg).
3030

3131
NuGet install from Package Manager:
3232
```
33-
Install-Package Amazon.Pay.API.SDK -Version 2.5.0
33+
Install-Package Amazon.Pay.API.SDK -Version 2.5.1
3434
```
3535

3636
NuGet install from .NET CLI:
@@ -42,12 +42,12 @@ Alternatively, to manually install after a GitHub download, use one of the follo
4242

4343
Visual Studio Package Manager Console
4444
```
45-
Install-Package Amazon.Pay.API.SDK -Version 2.5.0 -Source %USERPROFILE%\Downloads
45+
Install-Package Amazon.Pay.API.SDK -Version 2.5.1 -Source %USERPROFILE%\Downloads
4646
```
4747

4848
.NET Core CLI
4949
```
50-
dotnet add package Amazon.Pay.API.SDK -v 2.5.0 -s %USERPROFILE%\Downloads\
50+
dotnet add package Amazon.Pay.API.SDK -v 2.5.1 -s %USERPROFILE%\Downloads\
5151
```
5252

5353

@@ -315,18 +315,6 @@ public class Sample : PageModel
315315
}
316316
```
317317

318-
Note :
319-
As part of signature button integration, "algorithm" need to be provided as additional field in "createCheckoutSessionConfig" while rendering Amazon Pay button.
320-
321-
Example of "createCheckoutSessionConfig" :
322-
``` js
323-
createCheckoutSessionConfig: {
324-
payloadJSON: '{"webCheckoutDetails":{"checkoutReviewReturnUrl":"https://localhost/test/checkoutReview.html"},"storeId": "amzn1.application-oa2-client.xxxxx","scopes": ["name", "email", "phoneNumber", "billingAddress"]}',
325-
signature: 'SIGNATURE', // Signature Obtained by calling "generateButtonSignature(payload)" method
326-
algorithm: 'AMZN-PAY-RSASSA-PSS-V2' // This Parameter is mandatory
327-
}
328-
```
329-
330318
#### Passing Signature and Payload to Front-End
331319

332320
The code below shows how you could pass the signature and payload generated with code samples above back to the front-end. This sample uses an ASP.NET Core Razor Page, but the concept is similar for other .NET web project types.

0 commit comments

Comments
 (0)