@@ -49,7 +49,8 @@ To associate the key with your account, follow the instructions here to
4949 ' publicKeyId' : ' ABC123DEF456XYZ' , // RSA Public Key ID (this is not the Merchant or Seller ID)
5050 ' privateKey' : fs .readFileSync (' tst/private.pem' ), // Path to RSA Private Key (or a string representation)
5151 ' region' : ' us' , // Must be one of: 'us', 'eu', 'jp'
52- ' sandbox' : true // true (Sandbox) or false (Production) boolean
52+ ' sandbox' : true , // true (Sandbox) or false (Production) boolean
53+ ' algorithm' : ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
5354 };
5455```
5556
@@ -61,6 +62,7 @@ If you have created environment specific keys (i.e Public Key Starts with LIVE o
6162 ' publicKeyId' : ' PUBLIC_KEY_ID' , // LIVE-XXXXX or SANDBOX-XXXXX
6263 ' privateKey' : fs .readFileSync (' tst/private.pem' ), // Path to RSA Private Key (or a string representation)
6364 ' region' : ' us' , // Must be one of: 'us', 'eu', 'jp'
65+ ' algorithm' : ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
6466 };
6567```
6668
@@ -196,7 +198,8 @@ If you are a Solution Provider and need to make an API call on behalf of a diffe
196198 publicKeyId: ' ABC123DEF456XYZ' ,
197199 privateKey: fs .readFileSync (' tst/private.pem' ),
198200 region: ' us' ,
199- sandbox: true
201+ sandbox: true ,
202+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
200203 };
201204
202205 const payload = {
@@ -224,7 +227,8 @@ If you are a Solution Provider and need to make an API call on behalf of a diffe
224227 publicKeyId: ' ABC123DEF456XYZ' ,
225228 privateKey: fs .readFileSync (' tst/private.pem' ),
226229 region: ' us' ,
227- sandbox: true
230+ sandbox: true ,
231+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
228232 };
229233
230234 const payload = {
@@ -255,7 +259,8 @@ If you are a Solution Provider and need to make an API call on behalf of a diffe
255259 publicKeyId: ' ABC123DEF456XYZ' ,
256260 privateKey: fs .readFileSync (' tst/private.pem' ),
257261 region: ' us' ,
258- sandbox: true
262+ sandbox: true ,
263+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
259264 };
260265
261266 const headers = {
@@ -280,7 +285,8 @@ If you are a Solution Provider and need to make an API call on behalf of a diffe
280285 publicKeyId: ' ABC123DEF456XYZ' ,
281286 privateKey: fs .readFileSync (' tst/private.pem' ),
282287 region: ' us' ,
283- sandbox: true
288+ sandbox: true ,
289+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
284290 };
285291
286292 const payload = {
@@ -321,7 +327,8 @@ If you are a Solution Provider and need to make an API call on behalf of a diffe
321327 publicKeyId: ' ABC123DEF456XYZ' ,
322328 privateKey: fs .readFileSync (' tst/private.pem' ),
323329 region: ' us' ,
324- sandbox: true
330+ sandbox: true ,
331+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
325332 };
326333
327334 const payload = {
@@ -371,7 +378,8 @@ Example call to generateButtonSignature function:
371378 publicKeyId: ' ABC123DEF456XYZ' ,
372379 privateKey: fs .readFileSync (' tst/private.pem' ),
373380 region: ' us' ,
374- sandbox: true
381+ sandbox: true ,
382+ algorithm: ' AMZN-PAY-RSASSA-PSS-V2' // Amazon Signing Algorithm, Optional: uses AMZN-PAY-RSASSA-PSS if not specified
375383 };
376384
377385 const testPayClient = new Client.AmazonPayClient (config);
@@ -453,7 +461,7 @@ Example request method:
453461 const options = {
454462 method: ' POST' ,
455463 urlFragment: ' ${version}/in-store/merchantScan' ,
456- payload = {
464+ payload: {
457465 scanData: ' UKhrmatMeKdlfY6b' ,
458466 scanReferenceId: ' 0b8fb271-2ae2-49a5-b35d4' ,
459467 merchantCOE: ' US' ,
@@ -484,3 +492,208 @@ Example request method:
484492 const client = new Client.AmazonPayClient (config);
485493 const signedHeaders = client .getSignedHeaders (options);
486494```
495+
496+ # Reporting APIs code samples
497+
498+ ## Amazon Checkout v2 Reporting APIs - GetReport API
499+ ``` js
500+ const fs = require (' fs' );
501+ const uuidv4 = require (' uuid/v4' );
502+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
503+
504+ const config = {
505+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
506+ privateKey: fs .readFileSync (' tst/private.pem' ),
507+ region: ' us' ,
508+ sandbox: false ,
509+ };
510+
511+ const testPayClient = new Client.WebStoreClient (config);
512+ const requestPayload = {
513+ reportTypes: " _GET_FLAT_FILE_OFFAMAZONPAYMENTS_SETTLEMENT_DATA_" ,
514+ };
515+ const response = testPayClient .getReports (requestPayload);
516+
517+ response .then (function (result ) {
518+ console .log (result .data );
519+ }).catch (err => {
520+ console .log (err);
521+ });
522+ ```
523+
524+ ## Amazon Checkout v2 Reporting APIs - GetReportById API
525+ ``` js
526+ const fs = require (' fs' );
527+ const uuidv4 = require (' uuid/v4' );
528+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
529+
530+ const config = {
531+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
532+ privateKey: fs .readFileSync (' tst/private.pem' ),
533+ region: ' us' ,
534+ sandbox: false ,
535+ };
536+
537+ const reportId = ' 1234567890' ;
538+ const testPayClient = new Client.WebStoreClient (config);
539+ const response = testPayClient .getReportById (reportId);
540+
541+ response .then (function (result ) {
542+ console .log (result .data );
543+ }).catch (err => {
544+ console .log (err);
545+ });
546+ ```
547+
548+ ## Amazon Checkout v2 Reporting APIs - GetReportDocument API
549+ ``` js
550+ const fs = require (' fs' );
551+ const uuidv4 = require (' uuid/v4' );
552+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
553+
554+ const config = {
555+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
556+ privateKey: fs .readFileSync (' tst/private.pem' ),
557+ region: ' us' ,
558+ sandbox: false ,
559+ };
560+
561+ const reportDocumentId = ' 1234567890' ;
562+ const testPayClient = new Client.WebStoreClient (config);
563+ const response = testPayClient .getReportDocument (reportDocumentId);
564+
565+ response .then (function (result ) {
566+ console .log (result .data );
567+ }).catch (err => {
568+ console .log (err);
569+ });
570+ ```
571+
572+ ## Amazon Checkout v2 Reporting APIs - GetReportSchedules API
573+ ``` js
574+ const fs = require (' fs' );
575+ const uuidv4 = require (' uuid/v4' );
576+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
577+
578+ const config = {
579+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
580+ privateKey: fs .readFileSync (' tst/private.pem' ),
581+ region: ' us' ,
582+ sandbox: false ,
583+ };
584+
585+ const reportTypes = ' _GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_,_GET_FLAT_FILE_OFFAMAZONPAYMENTS_BILLING_AGREEMENT_DATA_' ;
586+ const testPayClient = new Client.WebStoreClient (config);
587+ const response = testPayClient .getReportSchedules (reportTypes);
588+
589+ response .then (function (result ) {
590+ console .log (result .data );
591+ }).catch (err => {
592+ console .log (err);
593+ });
594+ ```
595+
596+ ## Amazon Checkout v2 Reporting APIs - GetReportScheduleById API
597+ ``` js
598+ const fs = require (' fs' );
599+ const uuidv4 = require (' uuid/v4' );
600+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
601+
602+ const config = {
603+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
604+ privateKey: fs .readFileSync (' tst/private.pem' ),
605+ region: ' us' ,
606+ sandbox: false ,
607+ };
608+
609+ const reportScheduleId = ' 1234567890' ;
610+ const testPayClient = new Client.WebStoreClient (config);
611+ const response = testPayClient .getReportScheduleById (reportScheduleId);
612+
613+ response .then (function (result ) {
614+ console .log (result .data );
615+ }).catch (err => {
616+ console .log (err);
617+ });
618+ ```
619+
620+ ## Amazon Checkout v2 Reporting APIs - CreateReport API
621+ ``` js
622+ const fs = require (' fs' );
623+ const uuidv4 = require (' uuid/v4' );
624+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
625+
626+ const config = {
627+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
628+ privateKey: fs .readFileSync (' tst/private.pem' ),
629+ region: ' us' ,
630+ sandbox: false ,
631+ };
632+
633+ const requestPayload = {
634+ reportType: ' _GET_FLAT_FILE_OFFAMAZONPAYMENTS_AUTHORIZATION_DATA_' ,
635+ startTime: ' 20221114T074550Z' ,
636+ endTime: ' 20221114T074550Z'
637+ }
638+ const testPayClient = new Client.WebStoreClient (config);
639+ const response = testPayClient .createReport (requestPayload);
640+
641+ response .then (function (result ) {
642+ console .log (result .data );
643+ }).catch (err => {
644+ console .log (err);
645+ });
646+ ```
647+
648+ ## Amazon Checkout v2 Reporting APIs - CreateReportSchedule API
649+ ``` js
650+ const fs = require (' fs' );
651+ const uuidv4 = require (' uuid/v4' );
652+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
653+
654+ const config = {
655+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
656+ privateKey: fs .readFileSync (' tst/private.pem' ),
657+ region: ' us' ,
658+ sandbox: false ,
659+ };
660+
661+ const requestPayload = {
662+ reportType: " _GET_FLAT_FILE_OFFAMAZONPAYMENTS_ORDER_REFERENCE_DATA_" ,
663+ scheduleFrequency: " P1D" ,
664+ nextReportCreationTime: " 20230317T074550Z" ,
665+ deleteExistingSchedule: false
666+ }
667+ const testPayClient = new Client.WebStoreClient (config);
668+ const response = testPayClient .createReportSchedule (requestPayload);
669+
670+ response .then (function (result ) {
671+ console .log (result .data );
672+ }).catch (err => {
673+ console .log (err);
674+ });
675+ ```
676+
677+ ## Amazon Checkout v2 Reporting APIs - CancelReportSchedule API
678+ ``` js
679+ const fs = require (' fs' );
680+ const uuidv4 = require (' uuid/v4' );
681+ const Client = require (' @amazonpay/amazon-pay-api-sdk-nodejs' );
682+
683+ const config = {
684+ publicKeyId: ' YOUR_PUBLIC_KEY_ID' ,
685+ privateKey: fs .readFileSync (' tst/private.pem' ),
686+ region: ' us' ,
687+ sandbox: false ,
688+ };
689+
690+ const reportScheduleId = " 1234567890" ;
691+ const testPayClient = new Client.WebStoreClient (config);
692+ const response = testPayClient .cancelReportSchedule (reportScheduleId);
693+
694+ response .then (function (result ) {
695+ console .log (result .data );
696+ }).catch (err => {
697+ console .log (err);
698+ });
699+ ```
0 commit comments