/aws-services-go

Amazon Pay SDK for golang

Primary LanguageGo

Amazon Pay SDK for golang

  • Golang SDK for Amazon pay
  • Original Author: here

Changes:

  • Client constructor takes the struct for input
  • Since amazon has changed the generation of signature in v2 it's compatible here

Why new SDK?

  • Since the repository of original author hasn't been changed since 3 years so I decided to create one

Flow of the amazon pay:

  • Client inject the js script provided by the amazon
  • Client will generate a signature by providing the the payload to your server
  • Client gets the amazon button on clicking the button client redirects to the amazon site after adding card and shipping detail
    • on successful:
      • It will be redirected to the CheckoutReviewReturnURL
    • on cancel:
      • It will be redirected to the same page
  • Client will use the session ID generated by the amazon sessionID will be appended in the CheckoutReviewReturnURL to get the detail about the session
    • If there is missing value for successful payment you will get in the constraints property of the result of session detail
    • In case there is missing client needs to update the fields
  • Client will get the amazon checkout url in:
    • WebCheckoutDetails -> AmazonPayRedirectURL
    • Navigate to the AmazonPayRedirectURL and complete the process
    • ON PAYMENT SUCCESS: redirect to CheckoutResultReturnURL
    • ON PAYMENT CANCEL: redirect to CheckoutCancelUrl

USE SDK:

  • Create a client of amazonpay
  • Sign the payload using GenerateButtonSignature method
  • Get the session detail using GetCheckoutSession method
  • Update the payload using UpdateCheckoutSession method
  • Complete the checkout using CompleteCheckoutSession method