Documentation ¶
Index ¶
- Variables
- type APIError
- type Address
- type AmazonPay
- func (amazonPay *AmazonPay) Authorize(orderReferenceID string, authorizationReferenceID string, amount Price, ...) (result AuthorizeResponse, err error)
- func (amazonPay *AmazonPay) CancelOrderReference(orderReferenceID string, reason string) error
- func (amazonPay *AmazonPay) Capture(authorizationID string, captureReferenceID string, captureAmount Price, ...) (result CaptureResponse, err error)
- func (amazonPay *AmazonPay) CloseAuthorization(authorizationID string, closureReason string) error
- func (amazonPay *AmazonPay) CloseOrderReference(orderReferenceID string, closureReason string) error
- func (amazonPay *AmazonPay) ConfirmOrderReference(orderReferenceID string) error
- func (amazonPay *AmazonPay) GetAuthorizationDetails(authorizationID string) (result GetAuthorizationDetailsResponse, err error)
- func (amazonPay *AmazonPay) GetCaptureDetails(captureID string) (result GetCaptureDetailsResponse, err error)
- func (amazonPay *AmazonPay) GetOrderReferenceDetails(orderReferenceID string, addressToken string) (result GetOrderReferenceDetailsResponse, err error)
- func (amazonPay *AmazonPay) GetProfile(token string) (profile Profile, err error)
- func (amazonPay *AmazonPay) GetRefundDetails(refundID string) (result GetRefundDetailsResponse, err error)
- func (amazonPay *AmazonPay) Post(params Params, response interface{}) error
- func (amazonPay *AmazonPay) Refund(captureID string, refundReferenceID string, refundAmount Price, ...) (result RefundResponse, err error)
- func (amazonPay *AmazonPay) SetOrderReferenceDetails(orderReferenceID string, attrs OrderReferenceAttributes) (result SetOrderReferenceDetailsResult, err error)
- func (amazonPay *AmazonPay) Sign(message string) string
- type AmazonPayService
- type AuthorizationDetails
- type AuthorizationNotification
- type AuthorizeInput
- type AuthorizeResponse
- type Buyer
- type CaptureDetails
- type CaptureInput
- type CaptureNotification
- type CaptureResponse
- type Config
- type Constraint
- type Destination
- type GetAuthorizationDetailsResponse
- type GetCaptureDetailsResponse
- type GetOrderReferenceDetailsResponse
- type GetRefundDetailsResponse
- type IPN
- type Message
- func (msg Message) GetAuthorizationNotification() (AuthorizationNotification, error)
- func (msg Message) GetCaptureNotification() (CaptureNotification, error)
- func (msg Message) GetOrderReferenceNotification() (OrderReferenceNotification, error)
- func (msg Message) GetRefundNotification() (RefundNotification, error)
- type OAuthResponseError
- type OrderReferenceAttributes
- type OrderReferenceDetails
- type OrderReferenceNotification
- type OrderReferenceStatus
- type OrderTotal
- type Params
- type Price
- type Profile
- type RefundDetails
- type RefundInput
- type RefundNotification
- type RefundResponse
- type ResponseMetadata
- type SellerOrderAttributes
- type SetOrderReferenceDetailsResult
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( // OAuthEndpoint oauth endpoint OAuthEndpoint = "https://api.amazon.com" // OAuthSandboxEndpoint oauth endpoint for sandbox env OAuthSandboxEndpoint = "https://api.sandbox.amazon.com" )
var MWSServiceURLs = map[string]string{
"eu": "mws-eu.amazonservices.com",
"na": "mws.amazonservices.com",
"jp": "mws.amazonservices.jp",
}
MWSServiceURLs mwsservice urls
var RegionMappings = map[string]string{
"de": "eu",
"uk": "eu",
"us": "na",
"jp": "jp",
}
RegionMappings region mapping
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { XMLName xml.Name `xml:"ErrorResponse"` Type string `xml:"Error>Type"` Code string `xml:"Error>Code"` Message string `xml:"Error>Message"` }
APIError Amazon Pay API Error definition
type Address ¶
type Address struct { Name string AddressLine1, AddressLine2, AddressLine3 string City string Country string District string StateOrRegion string PostalCode string CountryCode string Phone string }
Address postal address information
type AmazonPay ¶
type AmazonPay struct {
*Config
}
AmazonPay amazon pay
func (*AmazonPay) Authorize ¶
func (amazonPay *AmazonPay) Authorize(orderReferenceID string, authorizationReferenceID string, amount Price, input AuthorizeInput) (result AuthorizeResponse, err error)
Authorize process secures the funds specified for the payment method stored in the Order Reference.
func (*AmazonPay) CancelOrderReference ¶
CancelOrderReference Cancels a previously confirmed order reference.
func (*AmazonPay) Capture ¶
func (amazonPay *AmazonPay) Capture(authorizationID string, captureReferenceID string, captureAmount Price, input CaptureInput) (result CaptureResponse, err error)
Capture request funds from the authorized payment method.
func (*AmazonPay) CloseAuthorization ¶
CloseAuthorization Close authorization
func (*AmazonPay) CloseOrderReference ¶
func (amazonPay *AmazonPay) CloseOrderReference(orderReferenceID string, closureReason string) error
CloseOrderReference complete order reference and will not be able to generate a new authorization from this Order Reference.
func (*AmazonPay) ConfirmOrderReference ¶
ConfirmOrderReference confirm order details
func (*AmazonPay) GetAuthorizationDetails ¶
func (amazonPay *AmazonPay) GetAuthorizationDetails(authorizationID string) (result GetAuthorizationDetailsResponse, err error)
GetAuthorizationDetails returns the total authorized amount for authorization status and authorization.
func (*AmazonPay) GetCaptureDetails ¶
func (amazonPay *AmazonPay) GetCaptureDetails(captureID string) (result GetCaptureDetailsResponse, err error)
GetCaptureDetails returns the detailed sales request status and the total amount refunded by sales request.
func (*AmazonPay) GetOrderReferenceDetails ¶
func (amazonPay *AmazonPay) GetOrderReferenceDetails(orderReferenceID string, addressToken string) (result GetOrderReferenceDetailsResponse, err error)
GetOrderReferenceDetails Returns the details and current state of the Order Reference object.
func (*AmazonPay) GetProfile ¶
GetProfile get user profile
func (*AmazonPay) GetRefundDetails ¶
func (amazonPay *AmazonPay) GetRefundDetails(refundID string) (result GetRefundDetailsResponse, err error)
GetRefundDetails get refund details
func (*AmazonPay) Refund ¶
func (amazonPay *AmazonPay) Refund(captureID string, refundReferenceID string, refundAmount Price, input RefundInput) (result RefundResponse, err error)
Refund refund the funds requested
func (*AmazonPay) SetOrderReferenceDetails ¶
func (amazonPay *AmazonPay) SetOrderReferenceDetails(orderReferenceID string, attrs OrderReferenceAttributes) (result SetOrderReferenceDetailsResult, err error)
SetOrderReferenceDetails set order details such as order amount and explanation in Order Reference
type AmazonPayService ¶
type AmazonPayService interface { GetProfile(token string) (profile Profile, err error) SetOrderReferenceDetails(orderReferenceID string, attrs OrderReferenceAttributes) (result SetOrderReferenceDetailsResult, err error) ConfirmOrderReference(orderReferenceID string) error GetOrderReferenceDetails(orderReferenceID string, addressToken string) (result GetOrderReferenceDetailsResponse, err error) Authorize(orderReferenceID string, authorizationReferenceID string, amount Price, input AuthorizeInput) (result AuthorizeResponse, err error) GetAuthorizationDetails(authorizationID string) (result GetAuthorizationDetailsResponse, err error) CloseAuthorization(authorizationID string, closureReason string) error Capture(authorizationID string, captureReferenceID string, captureAmount Price, input CaptureInput) (result CaptureResponse, err error) GetCaptureDetails(captureID string) (result GetCaptureDetailsResponse, err error) CloseOrderReference(orderReferenceID string, closureReason string) error CancelOrderReference(orderReferenceID string, reason string) error Refund(captureID string, refundReferenceID string, refundAmount Price, input RefundInput) (result RefundResponse, err error) GetRefundDetails(refundID string) (result GetRefundDetailsResponse, err error) Post(params Params, response interface{}) error Sign(message string) string }
type AuthorizationDetails ¶
type AuthorizationDetails struct { AmazonAuthorizationID string `xml:"AmazonAuthorizationId"` AuthorizationReferenceID string `xml:"AuthorizationReferenceId"` SellerAuthorizationNote string AuthorizationAmount Price CaptureAmount Price AuthorizationFee Price IDList []string `xml:"IdList"` CreationTimestamp *time.Time ExpirationTimestamp *time.Time AuthorizationStatus Status SoftDecline bool CaptureNow bool SoftDescriptor string }
AuthorizationDetails details and status of the authorization object, including sales charge amount.
type AuthorizationNotification ¶
type AuthorizationNotification struct {
AuthorizationDetails AuthorizationDetails
}
AuthorizationNotification authorization notification data
type AuthorizeInput ¶
type AuthorizeInput struct { SellerAuthorizationNote string TransactionTimedOut uint CaptureNow bool SoftDecriptor string }
AuthorizeInput authorize input struct
type AuthorizeResponse ¶
type AuthorizeResponse struct { AuthorizeResult struct { AuthorizationDetails AuthorizationDetails } ResponseMetadata ResponseMetadata }
AuthorizeResponse authorize response
type CaptureDetails ¶
type CaptureDetails struct { AmazonCaptureID string `xml:"AmazonCaptureId"` CaptureReferenceID string `xml:"CaptureReferenceId"` SellerCaptureNote string CaptureAmount Price RefundAmount Price CaptureFee Price IDList []string `xml:"IdList"` CreationTimestamp *time.Time CaptureStatus Status SoftDescriptor string }
CaptureDetails the details of the sales claim object and its current state.
type CaptureInput ¶
CaptureInput capture input struct
type CaptureNotification ¶
type CaptureNotification struct {
CaptureDetails CaptureDetails
}
CaptureNotification capture notification
type CaptureResponse ¶
type CaptureResponse struct { CaptureResult struct { CaptureDetails CaptureDetails } ResponseMetadata ResponseMetadata }
CaptureResponse capture response
type Config ¶
type Config struct { MerchantID string AccessKey string SecretKey string Sandbox bool Region string CurrencyCode string Endpoint string OAuthEndpoint string ModePath string APIVersion string PlatformID string }
Config Amazon Pay Config
Note on 'PlatformID':
According to AmazonPay docs, 'PlatformID' is the MerchatID, which is also referenced as SellerID https://developer.amazon.com/ja/docs/amazon-pay-api/setorderattributes.html But, in real life business, AmazonPay vendor may provide a different PlatformID for tracking incentives So you can set this seperately
type Constraint ¶
Constraint represents a mistake or error information of a Billing Agreement or Order Reference object.
type Destination ¶
Destination the address selected by the buyer via the address book widget.
type GetAuthorizationDetailsResponse ¶
type GetAuthorizationDetailsResponse struct { GetAuthorizationDetailsResult struct { AuthorizationDetails } ResponseMetadata ResponseMetadata }
GetAuthorizationDetailsResponse get authorization detail response
type GetCaptureDetailsResponse ¶
type GetCaptureDetailsResponse struct { GetCaptureDetailsResult struct { CaptureDetails CaptureDetails } ResponseMetadata ResponseMetadata }
GetCaptureDetailsResponse get capture details response
type GetOrderReferenceDetailsResponse ¶
type GetOrderReferenceDetailsResponse struct { GetOrderReferenceDetailsResult struct { OrderReferenceDetails OrderReferenceDetails } ResponseMetadata ResponseMetadata }
GetOrderReferenceDetailsResponse details and current state of the Order Reference object.
type GetRefundDetailsResponse ¶
type GetRefundDetailsResponse struct { GetRefundDetailsResult struct { RefundDetails RefundDetails } ResponseMetadata ResponseMetadata }
GetRefundDetailsResponse get refund detail response
type IPN ¶
type IPN struct { Type string MessageID string `json:"MessageId"` TopicArn string Timestamp string SignatureVersion string Signature string SigningCertURL string UnsubscribeURL string Message string }
IPN ipn message
func VerifyIPNRequest ¶
VerifyIPNRequest verify IPN request message
func (IPN) GetNotification ¶
GetNotification get notification message
type Message ¶
type Message struct { NotificationReferenceID string `json:"NotificationReferenceId"` NotificationType string SellerID string `json:"SellerId"` ReleaseEnvironment string Version string NotificationData string Timestamp string }
Message ipn message struct
func (Message) GetAuthorizationNotification ¶
func (msg Message) GetAuthorizationNotification() (AuthorizationNotification, error)
GetAuthorizationNotification get authorization notification data (notification type: PaymentAuthorize)
func (Message) GetCaptureNotification ¶
func (msg Message) GetCaptureNotification() (CaptureNotification, error)
GetCaptureNotification get capture notification data (notification type: PaymentCapture)
func (Message) GetOrderReferenceNotification ¶
func (msg Message) GetOrderReferenceNotification() (OrderReferenceNotification, error)
GetOrderReferenceNotification get order reference notification data (notification type: OrderReferenceNotification)
func (Message) GetRefundNotification ¶
func (msg Message) GetRefundNotification() (RefundNotification, error)
GetRefundNotification get refund notification data (notification type: PaymentRefund)
type OAuthResponseError ¶
type OAuthResponseError struct { ErrorDescription string `json:"error_description"` Error string `json:"error"` }
OAuthResponseError oauth error response
type OrderReferenceAttributes ¶
type OrderReferenceAttributes struct { OrderTotal OrderTotal PlatformID string `xml:"PlatformId"` SellerNote string SellerOrderAttributes SellerOrderAttributes }
OrderReferenceAttributes attribute of the Order Reference object specified by the seller.
type OrderReferenceDetails ¶
type OrderReferenceDetails struct { AmazonOrderReferenceID string `xml:"AmazonOrderReferenceId"` Buyer Buyer OrderTotal OrderTotal SellerNote string PlatformID string `xml:"PlatformId"` Destination Destination ReleaseEnvironment string SellerOrderAttributes SellerOrderAttributes OrderReferenceStatus OrderReferenceStatus Constraints []Constraint CreationTimestamp *time.Time ExpirationTimestamp *time.Time IDList []string `xml:"IdList"` }
OrderReferenceDetails details and current state of the Order Reference object.
type OrderReferenceNotification ¶
type OrderReferenceNotification struct {
OrderReference OrderReferenceDetails
}
OrderReferenceNotification order reference notification data
type OrderReferenceStatus ¶
type OrderReferenceStatus struct { State string LastUpdateTimestamp *time.Time ReasonCode string ReasonDescription string }
OrderReferenceStatus the current state of the Order Reference object.
type OrderTotal ¶
OrderTotal total order amount presented in this Order Reference.
type Params ¶
type Params map[string]interface{}
Params API params
type Profile ¶
type Profile struct { UserID string `json:"user_id"` Name string `json:"name"` Email string `json:"email"` }
Profile user profile
type RefundDetails ¶
type RefundDetails struct { AmazonRefundID string `xml:"AmazonRefundId"` RefundReferenceID string `xml:"RefundReferenceId"` SellerRefundNote string RefundType string RefundAmount Price FeeRefunded Price CreationTimestamp *time.Time RefundStatus Status SoftDescriptor string }
RefundDetails details and the current state of the refund object.
type RefundInput ¶
RefundInput refund input struct
type RefundNotification ¶
type RefundNotification struct {
RefundDetails RefundDetails
}
RefundNotification refund notification
type RefundResponse ¶
type RefundResponse struct { RefundResult struct { RefundDetails RefundDetails } ResponseMetadata ResponseMetadata }
RefundResponse get refund response
type ResponseMetadata ¶
type ResponseMetadata struct {
RequestID string `xml:"RequestId"`
}
ResponseMetadata respones meta data
type SellerOrderAttributes ¶
type SellerOrderAttributes struct { SellerOrderID string `xml:"SellerOrderId"` StoreName string CustomInformation string }
SellerOrderAttributes provides detailed information on the Order Reference object
type SetOrderReferenceDetailsResult ¶
type SetOrderReferenceDetailsResult struct { SetOrderReferenceDetailsResult struct { OrderReferenceDetails OrderReferenceDetails } ResponseMetadata ResponseMetadata }
SetOrderReferenceDetailsResult set order reference detail