Skip to content

Instantly share code, notes, and snippets.

@Lkubok

Lkubok/amazon1.txt

Created Jun 8, 2020
Embed
What would you like to do?
<div id="AmazonPayButton"/>
<script type="text/javascript">
var authRequest;
OffAmazonPayments.Button("AmazonPayButton", "YOUR_MERCHANT_ID ", {
type: "ENTER_TYPE_PARAMETER",
color: "ENTER_COLOR_PARAMETER",
size: "ENTER_SIZE_PARAMETER",
authorization: function() {
loginOptions =
{scope: "ENTER_SCOPES", popup: "ENTER_POPUP_PARAMETER"};
authRequest = amazon.Login.authorize (loginOptions,
"YOUR_REDIRECT_URL ");
},
onError: function(error) {
// your error handling code
}
});
</script>
<!--- please put the style below inside your CSS file -->
<style type="text/css">
#addressBookWidgetDiv{width: 400px; height: 228px;}
</style>
<div id="addressBookWidgetDiv">
</div>
<script>
new OffAmazonPayments.Widgets.AddressBook({
sellerId: 'YOUR_SELLER_ID_HERE',
agreementType: 'BillingAgreement',
onReady: function(billingAgreement) {
var billingAgreementId = billingAgreement.
getAmazonBillingAgreementId();
},
onAddressSelect: function(billingAgreement) {
// Replace the following code with the action that you want to perform
// after the address is selected.
// The amazonBillingAgreementId can be used to retrieve
// the address details by calling the GetBillingAgreementDetails operation.
// If rendering the AddressBook and Wallet widgets on the same page, you
// should wait for this event before you render the Wallet widget for
// the first time.
// The Wallet widget re-renders itself on all subsequent
// onAddressSelect events without any action from you. We don't
// recommend that you explicitly refresh it.
},
design: {
designMode: 'responsive'
},
onError: function(error) {
// your error handling code
}
}).bind("addressBookWidgetDiv");
</script>
<!--- put the style below inside your CSS file -->
<style type="text/css">
#consentWidgetDiv {width: 400px; height: 140px;}
</style>
<div id="consentWidgetDiv">
</div>
<script>
new OffAmazonPayments.Widgets.Consent({
sellerId: 'YOUR_SELLER_ID_HERE',
// amazonBillingAgreementId obtained from the Amazon Address Book widget.
amazonBillingAgreementId: amazonBillingAgreementId,
design: {
designMode: 'responsive'
},
onReady: function(billingAgreementConsentStatus){
// Called after widget renders
buyerBillingAgreementConsentStatus =
billingAgreementConsentStatus.getConsentStatus();
// getConsentStatus returns true or false
// true - checkbox is selected
// false - checkbox is unselected - default
},
onConsent: function(billingAgreementConsentStatus) {
buyerBillingAgreementConsentStatus =
billingAgreementConsentStatus.getConsentStatus();
// getConsentStatus returns true or false
// true - checkbox is selected - buyer has consented
// false - checkbox is unselected - buyer has not consented
// Replace this code with the action that you want to perform
// after the consent checkbox is selected/unselected.
},
onError: function(error) {
// your error handling code
}
}).bind("consentWidgetDiv ");
</script>
https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01?
AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE
&AmazonBillingAgreementId=C01-8824045-7416542
&Action=SetBillingAgreementDetails
&BillingAgreementAttributes.PlatformId=PLATFORM_ID_HERE
&BillingAgreementAttributes.SellerNote=APPROVE LITE APPROVE HEAVY
&BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformati
on=Example Customer Info
&BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName=Test Store Name
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&SellerId=YOUR_SELLER_ID_HERE
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2013-12-11T10:57:18.000Z
&Version=2013-01-01
&Signature=Z0ZVgWu0ICF4FLxt1mTjyK+jdYG6Kmm8JxLTfsQtKRY=
https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01?AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE
&AmazonBillingAgreementId=C01-8824045-7416542
&Action=ValidateBillingAgreement
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&SellerId=YOUR_SELLER_ID_HERE
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2013-12-11T10%3A38%3A44.000Z
&Version=2013-01-01
&Signature=gP11oEBaaiQdASWsLDyid18Wn%2BB%2FKZQQtKgpHCtDHdc%3D
https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01 ?AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE
&Action=AuthorizeOnBillingAgreement
&AmazonBillingAgreementId=C01-1234567-1234567
&AuthorizationAmount.Amount=10
&AuthorizationAmount.CurrencyCode=USD
&AuthorizationReferenceId=test_authorize_1
&MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
&SellerId=YOUR_SELLER_ID_HERE
&SellerAuthorizationNote=ForNovemberOrder
&SellerOrderAttributes.SellerOrderId=testSellerOrderId
&SellerOrderAttributes.StoreName=testStore
&SellerOrderAttributes.CustomInformation=ExampleInformation
&InheritShippingAddress=true
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2012-10-03T19%3A01%3A11Z
&TransactionTimeout=60
&Version=2013-01-01
&Signature=WlQ708aqyHXMkoUBk69Hjxj8qdh3aDcqpY71hVgEXAMPLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.