An open API service indexing awesome lists of open source software.

https://github.com/mukezhz/aws-services-go

Amazon Pay SDK for golang
https://github.com/mukezhz/aws-services-go

amazon-pay amazon-pay-go amazon-pay-sdk aws aws-pay-go aws-services

Last synced: 3 months ago
JSON representation

Amazon Pay SDK for golang

Awesome Lists containing this project

README

        

# Amazon Pay SDK for golang

- Golang SDK for Amazon pay
- Original Author: [here](https://github.com/gotokatsuya/amazon-pay-sdk-go)

## 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