Amazon Pay SDK for Golang
go get github.com/qor/amazon-pay-sdk-go
import amazonpay "github.com/qor/amazon-pay-sdk-go"
func main() {
var client = amazonpay.New(&amazonpay.Config{
MerchantID: "my merchant id",
AccessKey: "my access key",
SecretKey: "my secret key",
Sandbox: true,
Region: "jp",
})
// Set order details such as order amount and explanation in Order Reference
client.SetOrderReferenceDetails(orderReferenceID, amazonpay.OrderReferenceAttributes) (amazonpay.SetOrderReferenceDetailsResult, error)
// confirm order details
client.ConfirmOrderReference(orderReferenceID) error
// Returns the details and current state of the Order Reference object
client.GetOrderReferenceDetails(orderReferenceID, addressToken) (amazonpay.GetOrderReferenceDetailsResponse, error)
// Process secures the funds specified for the payment method stored in the Order Reference
client.Authorize(orderReferenceID, authorizationReferenceID, amount, amazonpay.AuthorizeInput) (amazonpay.AuthorizeResponse, error)
// Returns the total authorized amount for authorization status and authorization
client.GetAuthorizationDetails(authorizationID) (amazonpay.GetAuthorizationDetailsResponse, error)
// CloseAuthorization Close authorization
client.CloseAuthorization(authorizationID, closureReason) error
// Request funds from the authorized payment method
client.Capture(authorizationID, captureReferenceID, captureAmount, amazonpay.CaptureInput) (amazonpay.CaptureResponse, error)
// Returns the detailed sales request status and the total amount refunded by sales request
client.GetCaptureDetails(captureID) (amazonpay.GetCaptureDetailsResponse, error)
// Complete order reference and will not be able to generate a new authorization from this Order Reference
client.CloseOrderReference(orderReferenceID, closureReason) error
// CancelOrderReference Cancels a previously confirmed order reference
client.CancelOrderReference(orderReferenceID, reason) error
// Refund refund the funds requested
client.Refund(captureID, refundReferenceID, refundAmount, amazonpay.RefundInput) (amazonpay.RefundResponse, error)
// Get refund details
client.GetRefundDetails(refundID) (amazonpay.GetRefundDetailsResponse, error)
}
Verify ipn notification
amazonpay.VerifyIPNRequest(req)
We have deployed a demo that integrated Amazon Pay sandbox mode, visit it here: https://demo.getqor.com
You can place orders with our Amazon sandbox account: demo@getqor.com
/ qordemo
After placed orders, you can manage them via our admin interface, like take auth
, capture
, refund
orders, the admin interface is generated with QOR Admin
https://github.com/qor/qor-example
Released under the MIT License.