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) AuthorizeOnBillingAgreement(billingAgreementID string, authorizationReferenceID string, amount Price, ...) (result AuthorizeOnBillingAgreementResponse, 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) CloseBillingAgreement(billingAgreementID string, closureReason string) error
- func (amazonPay *AmazonPay) CloseOrderReference(orderReferenceID string, closureReason string) error
- func (amazonPay *AmazonPay) ConfirmBillingAgreement(billingAgreementID string) error
- func (amazonPay *AmazonPay) ConfirmOrderReference(orderReferenceID string) error
- func (amazonPay *AmazonPay) CreateOrderReferenceForId(id string, idType string, input CreateOrderReferenceForIdInput) (result CreateOrderReferenceForIdResponse, err error)
- func (amazonPay *AmazonPay) GetAuthorizationDetails(authorizationID string) (result GetAuthorizationDetailsResponse, err error)
- func (amazonPay *AmazonPay) GetBillingAgreementDetails(billingAgreementID string, addressConsentToken string) (result GetBillingAgreementDetailsResponse, 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) SetBillingAgreementDetails(billingAgreementID string, attrs BillingAgreementAttributes) (result SetBillingAgreementDetailsResponse, err error)
- func (amazonPay *AmazonPay) SetOrderReferenceDetails(orderReferenceID string, attrs OrderReferenceAttributes) (result SetOrderReferenceDetailsResult, err error)
- func (amazonPay *AmazonPay) Sign(message string) string
- func (amazonPay *AmazonPay) ValidateBillingAgreement(billingAgreementID string) (result ValidateBillingAgreementResponse, err error)
- type AmazonPayService
- type AuthorizationDetails
- type AuthorizationNotification
- type AuthorizeInput
- type AuthorizeOnBillingAgreementInput
- type AuthorizeOnBillingAgreementResponse
- type AuthorizeResponse
- type BillingAgreementAttributes
- type BillingAgreementDetails
- type BillingAgreementLimits
- type BillingAgreementNotification
- type BillingAgreementStatus
- type Buyer
- type CaptureDetails
- type CaptureInput
- type CaptureNotification
- type CaptureResponse
- type Config
- type Constraint
- type CreateOrderReferenceForIdInput
- type CreateOrderReferenceForIdResponse
- type Destination
- type GetAuthorizationDetailsResponse
- type GetBillingAgreementDetailsResponse
- type GetCaptureDetailsResponse
- type GetOrderReferenceDetailsResponse
- type GetRefundDetailsResponse
- type IPN
- type Message
- func (msg Message) GetAuthorizationNotification() (AuthorizationNotification, error)
- func (msg Message) GetBillingAgreementNotification() (BillingAgreementNotification, 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 SellerBillingAgreementAttributes
- type SellerOrderAttributes
- type SetBillingAgreementDetailsResponse
- type SetOrderReferenceDetailsResult
- type Status
- type ValidateBillingAgreementResponse
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) AuthorizeOnBillingAgreement ¶
func (amazonPay *AmazonPay) AuthorizeOnBillingAgreement(billingAgreementID string, authorizationReferenceID string, amount Price, input AuthorizeOnBillingAgreementInput) (result AuthorizeOnBillingAgreementResponse, err error)
AuthorizeOnBillingAgreement process secures the funds specified for the payment method stored in the Billing Agreement.
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) CloseBillingAgreement ¶
func (amazonPay *AmazonPay) CloseBillingAgreement(billingAgreementID string, closureReason string) error
CloseBillingAgreement Close billing agreement
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) ConfirmBillingAgreement ¶
ConfirmBillingAgreement confirm billing agreement
func (*AmazonPay) ConfirmOrderReference ¶
ConfirmOrderReference confirm order details
func (*AmazonPay) CreateOrderReferenceForId ¶
func (amazonPay *AmazonPay) CreateOrderReferenceForId(id string, idType string, input CreateOrderReferenceForIdInput) (result CreateOrderReferenceForIdResponse, err error)
CreateOrderReferenceForId creates an order reference.
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) GetBillingAgreementDetails ¶
func (amazonPay *AmazonPay) GetBillingAgreementDetails(billingAgreementID string, addressConsentToken string) (result GetBillingAgreementDetailsResponse, err error)
GetBillingAgreementDetails returns the details and current state of the Billing Agreement object.
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) SetBillingAgreementDetails ¶
func (amazonPay *AmazonPay) SetBillingAgreementDetails(billingAgreementID string, attrs BillingAgreementAttributes) (result SetBillingAgreementDetailsResponse, err error)
SetBillingAgreementDetails set billing agreement such as a description of the agreement and other information about the merchant.
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
func (*AmazonPay) ValidateBillingAgreement ¶
func (amazonPay *AmazonPay) ValidateBillingAgreement(billingAgreementID string) (result ValidateBillingAgreementResponse, err error)
ValidateBillingAgreement validates the status of the BillingAgreement object and the payment method associated with it.
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 TransactionTimeout uint CaptureNow bool SoftDescriptor string }
AuthorizeInput authorize input struct
type AuthorizeOnBillingAgreementInput ¶
type AuthorizeOnBillingAgreementInput struct { SellerAuthorizationNote string TransactionTimeout uint CaptureNow bool SoftDecriptor string SellerNote string PlatformID string `json:"PlatformId"` SellerOrderAttributes SellerOrderAttributes InheritShippingAddress bool }
AuthorizeOnBillingAgreementInput authorize on billing agreement input struct
type AuthorizeOnBillingAgreementResponse ¶
type AuthorizeOnBillingAgreementResponse struct { AuthorizeOnBillingAgreementResult struct { AuthorizationDetails AuthorizationDetails AmazonOrderReferenceID string `xml:"AmazonOrderReferenceId"` } ResponseMetadata ResponseMetadata }
AuthorizeOnBillingAgreementResponse get authorize on billing agreement response
type AuthorizeResponse ¶
type AuthorizeResponse struct { AuthorizeResult struct { AuthorizationDetails AuthorizationDetails } ResponseMetadata ResponseMetadata }
AuthorizeResponse authorize response
type BillingAgreementAttributes ¶
type BillingAgreementAttributes struct { PlatformID string `xml:"PlatformId"` SellerNote string SellerBillingAgreementAttributes SellerBillingAgreementAttributes }
BillingAgreementAttributes attribute of the Billing Agreement.
type BillingAgreementDetails ¶
type BillingAgreementDetails struct { AmazonBillingAgreementID string `xml:"AmazonBillingAgreementId"` BillingAgreementLimits BillingAgreementLimits Buyer Buyer SellerNote string PlatformID string `xml:"PlatformId"` Destination Destination ReleaseEnvironment string SellerBillingAgreementAttributes SellerBillingAgreementAttributes BillingAgreementStatus BillingAgreementStatus Constraints []Constraint CreationTimestamp *time.Time BillingAgreementConsent bool }
BillingAgreementDetails details and current state of the billing agreement.
type BillingAgreementLimits ¶
type BillingAgreementLimits struct { AmountLimitPerTimePeriod Price TimePeriodStartDate *time.Time TimePeriodEndDate *time.Time CurrentRemainingBalance Price }
BillingAgreementLimits represents a billing agreement limits.
type BillingAgreementNotification ¶
type BillingAgreementNotification struct {
BillingAgreementDetails BillingAgreementDetails
}
BillingAgreementNotification billing agreement notification
type BillingAgreementStatus ¶
type BillingAgreementStatus struct { State string LastUpdatedTimestamp *time.Time ReasonCode string ReasonDescription string }
BillingAgreementStatus the current state of the Billing Agreement object.
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 CreateOrderReferenceForIdInput ¶
type CreateOrderReferenceForIdInput struct { InheritShippingAddress bool ConfirmNow bool OrderReferenceAttributes OrderReferenceAttributes }
CreateOrderReferenceForIdInput create order reference for id input struct
type CreateOrderReferenceForIdResponse ¶
type CreateOrderReferenceForIdResponse struct { CreateOrderReferenceForIdResult struct { OrderReferenceDetails OrderReferenceDetails } ResponseMetadata ResponseMetadata }
CreateOrderReferenceForIdResponse get 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 AuthorizationDetails } ResponseMetadata ResponseMetadata }
GetAuthorizationDetailsResponse get authorization detail response
type GetBillingAgreementDetailsResponse ¶
type GetBillingAgreementDetailsResponse struct { GetBillingAgreementDetailsResult struct { BillingAgreementDetails BillingAgreementDetails } ResponseMetadata ResponseMetadata }
GetBillingAgreementDetailsResponse details and current state of the Billing Agreement object.
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) GetBillingAgreementNotification ¶
func (msg Message) GetBillingAgreementNotification() (BillingAgreementNotification, error)
GetBillingAgreementNotification get billing agreement notification data (notification type: BillingAgreementNotification)
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 SellerBillingAgreementAttributes ¶
type SellerBillingAgreementAttributes struct { SellerBillingAgreementID string `xml:"SellerBillingAgreementId"` StoreName string CustomInformation string }
SellerBillingAgreementAttributes attribute of the Seller Billing Agreement.
type SellerOrderAttributes ¶
type SellerOrderAttributes struct { SellerOrderID string `xml:"SellerOrderId" json:"SellerOrderId"` StoreName string CustomInformation string }
SellerOrderAttributes provides detailed information on the Order Reference object
type SetBillingAgreementDetailsResponse ¶
type SetBillingAgreementDetailsResponse struct { SetBillingAgreementDetailsResult struct { BillingAgreementDetails BillingAgreementDetails } ResponseMetadata ResponseMetadata }
SetBillingAgreementDetailsResponse set billing agreement detail
type SetOrderReferenceDetailsResult ¶
type SetOrderReferenceDetailsResult struct { SetOrderReferenceDetailsResult struct { OrderReferenceDetails OrderReferenceDetails } ResponseMetadata ResponseMetadata }
SetOrderReferenceDetailsResult set order reference detail
type Status ¶
type Status struct { State string LastUpdateTimestamp *time.Time ReasonCode string ReasonDescription string }
Status represents the current status of authorization object, sales request object, refund object.
type ValidateBillingAgreementResponse ¶
type ValidateBillingAgreementResponse struct { ValidateBillingAgreementResult struct { ValidationResult string FailureReasonCode string BillingAgreementStatus BillingAgreementStatus } ResponseMetadata ResponseMetadata }
ValidateBillingAgreementResponse result of billing agreement validation.