Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // add Login and Pay callbacks
  2.  
  3. window.onAmazonPaymentsReady = () => {
  4. this.createButton(sellerId, scope, type, color, size, mountLocation);
  5. }
  6.  
  7. // if the OffAmazonPayments namespace is already available, call the callback manually - otherwise wait for Amazon to call it
  8.  
  9. if (typeof window.OffAmazonPayments !== 'undefined') {
  10. window.onAmazonPaymentsReady();
  11. }
  12.  
  13. createButton(sellerId, scope, type, color, size, mountLocation) {
  14.  
  15. window.OffAmazonPayments.Button(mountLocation, sellerId, {
  16. type,
  17. color,
  18. size,
  19. authorization: () => {
  20. const loginOptions = { scope };
  21.  
  22. window.amazon.Login.authorize(loginOptions, this.onAuthorize);
  23. },
  24. onError: this.onError,
  25. });
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement