Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func Int(v int) *int
- func Int64(v int64) *int64
- func MustParseInt64(v string) int64
- func ParseInt64(v string) (int64, error)
- func String(v string) *string
- type AddressDetails
- type Buyer
- type ChargePermissionResponse
- type CheckoutSessionResponse
- type Client
- func (c *Client) CloseChargePermission(ctx context.Context, chargePermissionID string, ...) (*CloseChargePermissionResponse, *http.Response, error)
- func (c *Client) CompleteCheckoutSession(ctx context.Context, checkoutSessionID string, ...) (*CompleteCheckoutSessionResponse, *http.Response, error)
- func (c *Client) CreateCharge(ctx context.Context, req *CreateChargeRequest) (*CreateChargeResponse, *http.Response, error)
- func (c *Client) CreateRefund(ctx context.Context, req *CreateRefundRequest) (*CreateRefundResponse, *http.Response, error)
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GenerateButtonSignature(payload string) (string, error)
- func (c *Client) GetChargePermission(ctx context.Context, chargePermissionID string) (*GetChargePermissionResponse, *http.Response, error)
- func (c *Client) GetCheckoutSession(ctx context.Context, checkoutSessionID string) (*GetCheckoutSessionResponse, *http.Response, error)
- func (c *Client) GetRefund(ctx context.Context, refundID string) (*GetRefundResponse, *http.Response, error)
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) UpdateCheckoutSession(ctx context.Context, checkoutSessionID string, ...) (*UpdateCheckoutSessionResponse, *http.Response, error)
- type CloseChargePermissionRequest
- type CloseChargePermissionResponse
- type CompleteCheckoutSessionRequest
- type CompleteCheckoutSessionResponse
- type Constraint
- type CreateChargeRequest
- type CreateChargeResponse
- type CreateCheckoutSessionRequest
- type CreateRefundRequest
- type CreateRefundResponse
- type DeliverySpecifications
- type ErrorResponse
- type Frequency
- type GetChargePermissionResponse
- type GetCheckoutSessionResponse
- type GetRefundResponse
- type Limits
- type MerchantMetadata
- type PaymentDetails
- type PaymentPreference
- type Price
- type ProviderMetadata
- type Reason
- type RecurringMetadata
- type RefundResponse
- type StatusDetails
- type UpdateCheckoutSessionRequest
- type UpdateCheckoutSessionResponse
- type WebCheckoutDetails
Constants ¶
View Source
const (
APIVersion = "v2"
)
View Source
const (
SDKVersion = "2.2.1"
)
Variables ¶
View Source
var ( RegionMap = map[string]string{ "eu": "eu", "de": "eu", "uk": "eu", "us": "na", "na": "na", "jp": "jp", } RegionHostMap = map[string]string{ "eu": "pay-api.amazon.eu", "na": "pay-api.amazon.com", "jp": "pay-api.amazon.jp", } )
Functions ¶
func MustParseInt64 ¶
MustParseInt64 string to int64 without error function
Types ¶
type AddressDetails ¶
type AddressDetails struct { Name string `json:"name,omitempty"` AddressLine1 string `json:"addressLine1,omitempty"` AddressLine2 string `json:"addressLine2,omitempty"` AddressLine3 string `json:"addressLine3,omitempty"` City string `json:"city,omitempty"` County string `json:"county,omitempty"` District string `json:"district,omitempty"` StateOrRegion string `json:"stateOrRegion,omitempty"` PostalCode string `json:"postalCode,omitempty"` CountryCode string `json:"countryCode,omitempty"` PhoneNumber string `json:"phoneNumber,omitempty"` }
type ChargePermissionResponse ¶
type ChargePermissionResponse struct { ErrorResponse ChargePermissionID string `json:"chargePermissionId,omitempty"` ChargePermissionReferenceID string `json:"chargePermissionReferenceId,omitempty"` Buyer *Buyer `json:"buyer,omitempty"` ReleaseEnvironment string `json:"releaseEnvironment,omitempty"` ShippingAddress *AddressDetails `json:"shippingAddress,omitempty"` BillingAddress *AddressDetails `json:"billingAddress,omitempty"` PaymentPreferences []PaymentPreference `json:"paymentPreferences,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` CreationTimestamp string `json:"creationTimestamp,omitempty"` ExpirationTimestamp string `json:"expirationTimestamp,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` PlatformID string `json:"platformId,omitempty"` Limits *Limits `json:"limits,omitempty"` PresentmentCurrency string `json:"presentmentCurrency,omitempty"` }
type CheckoutSessionResponse ¶
type CheckoutSessionResponse struct { ErrorResponse CheckoutSessionID string `json:"checkoutSessionId,omitempty"` WebCheckoutDetails *WebCheckoutDetails `json:"webCheckoutDetails,omitempty"` ChargePermissionType string `json:"chargePermissionType,omitempty"` RecurringMetadata *RecurringMetadata `json:"recurringMetadata,omitempty"` ProductType string `json:"productType,omitempty"` PaymentDetails *PaymentDetails `json:"paymentDetails,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` Buyer *Buyer `json:"buyer,omitempty"` BillingAddress *AddressDetails `json:"billingAddress,omitempty"` PaymentPreferences []PaymentPreference `json:"paymentPreferences,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` ShippingAddress *AddressDetails `json:"shippingAddress,omitempty"` PlatformID string `json:"platformId,omitempty"` ChargePermissionID string `json:"chargePermissionId,omitempty"` ChargeID string `json:"chargeId,omitempty"` Constraints []Constraint `json:"constraints,omitempty"` CreationTimestamp string `json:"creationTimestamp,omitempty"` ExpirationTimestamp string `json:"expirationTimestamp,omitempty"` StoreID string `json:"storeId,omitempty"` DeliverySpecifications *DeliverySpecifications `json:"deliverySpecifications,omitempty"` ProviderMetadata *ProviderMetadata `json:"providerMetadata,omitempty"` ReleaseEnvironment string `json:"releaseEnvironment,omitempty"` }
type Client ¶
type Client struct { PublicKeyID string PrivateKey []byte Region string Sandbox bool HTTPClient *http.Client // contains filtered or unexported fields }
Client type
func New ¶
func New(publicKeyID string, privateKey []byte, region string, sandbox bool, httpClient *http.Client) (*Client, error)
New returns a new pay client instance.
func (*Client) CloseChargePermission ¶
func (c *Client) CloseChargePermission(ctx context.Context, chargePermissionID string, req *CloseChargePermissionRequest) (*CloseChargePermissionResponse, *http.Response, error)
func (*Client) CompleteCheckoutSession ¶
func (c *Client) CompleteCheckoutSession(ctx context.Context, checkoutSessionID string, req *CompleteCheckoutSessionRequest) (*CompleteCheckoutSessionResponse, *http.Response, error)
func (*Client) CreateCharge ¶
func (c *Client) CreateCharge(ctx context.Context, req *CreateChargeRequest) (*CreateChargeResponse, *http.Response, error)
func (*Client) CreateRefund ¶
func (c *Client) CreateRefund(ctx context.Context, req *CreateRefundRequest) (*CreateRefundResponse, *http.Response, error)
func (*Client) GenerateButtonSignature ¶
GenerateButtonSignature method
func (*Client) GetChargePermission ¶
func (*Client) GetCheckoutSession ¶
func (*Client) NewRequest ¶
NewRequest method
func (*Client) UpdateCheckoutSession ¶
func (c *Client) UpdateCheckoutSession(ctx context.Context, checkoutSessionID string, req *UpdateCheckoutSessionRequest) (*UpdateCheckoutSessionResponse, *http.Response, error)
type CloseChargePermissionResponse ¶
type CloseChargePermissionResponse ChargePermissionResponse
type CompleteCheckoutSessionRequest ¶
type CompleteCheckoutSessionRequest struct {
ChargeAmount *Price `json:"chargeAmount,omitempty"`
}
type CompleteCheckoutSessionResponse ¶
type CompleteCheckoutSessionResponse CheckoutSessionResponse
type Constraint ¶
type CreateChargeRequest ¶
type CreateChargeRequest struct { ChargePermissionID string `json:"chargePermissionId,omitempty"` ChargeAmount *Price `json:"chargeAmount,omitempty"` CaptureNow *bool `json:"captureNow,omitempty"` SoftDescriptor string `json:"softDescriptor,omitempty"` CanHandlePendingAuthorization *bool `json:"canHandlePendingAuthorization,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` ProviderMetadata *ProviderMetadata `json:"providerMetadata,omitempty"` }
type CreateChargeResponse ¶
type CreateChargeResponse struct { ErrorResponse ChargeID string `json:"chargeId,omitempty"` ChargePermissionID string `json:"chargePermissionId,omitempty"` ChargeAmount *Price `json:"chargeAmount,omitempty"` CaptureAmount *Price `json:"captureAmount,omitempty"` RefundedAmount *Price `json:"refundedAmount,omitempty"` ConvertedAmount string `json:"convertedAmount,omitempty"` ConversionRate string `json:"conversionRate,omitempty"` SoftDescriptor string `json:"softDescriptor,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` ProviderMetadata *ProviderMetadata `json:"providerMetadata,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` CreationTimestamp string `json:"creationTimestamp,omitempty"` ExpirationTimestamp string `json:"expirationTimestamp,omitempty"` ReleaseEnvironment string `json:"releaseEnvironment,omitempty"` }
type CreateCheckoutSessionRequest ¶
type CreateCheckoutSessionRequest struct { WebCheckoutDetails *WebCheckoutDetails `json:"webCheckoutDetails,omitempty"` StoreID string `json:"storeId,omitempty"` ChargePermissionType string `json:"chargePermissionType,omitempty"` RecurringMetadata *RecurringMetadata `json:"recurringMetadata,omitempty"` DeliverySpecifications *DeliverySpecifications `json:"deliverySpecifications,omitempty"` PaymentDetails *PaymentDetails `json:"paymentDetails,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` PlatformID string `json:"platformId,omitempty"` ProviderMetadata *ProviderMetadata `json:"providerMetadata,omitempty"` AddressDetails *AddressDetails `json:"addressDetails,omitempty"` }
func (*CreateCheckoutSessionRequest) ToPayload ¶
func (c *CreateCheckoutSessionRequest) ToPayload() (string, error)
type CreateRefundRequest ¶
type CreateRefundResponse ¶
type CreateRefundResponse RefundResponse
type DeliverySpecifications ¶
type DeliverySpecifications struct { SpecialRestrictions []string `json:"specialRestrictions,omitempty"` AddressRestrictions struct { Type string `json:"type,omitempty"` Restrictions struct { US struct { StatesOrRegions []string `json:"statesOrRegions,omitempty"` ZipCodes []string `json:"zipCodes,omitempty"` } `json:"US,omitempty"` GB struct { ZipCodes []string `json:"zipCodes,omitempty"` } `json:"GB,omitempty"` IN struct { StatesOrRegions []string `json:"statesOrRegions,omitempty"` } `json:"IN,omitempty"` JP struct { } `json:"JP,omitempty"` } `json:"restrictions,omitempty"` } `json:"addressRestrictions,omitempty"` }
type ErrorResponse ¶
type GetChargePermissionResponse ¶
type GetChargePermissionResponse ChargePermissionResponse
type GetCheckoutSessionResponse ¶
type GetCheckoutSessionResponse CheckoutSessionResponse
type GetRefundResponse ¶
type GetRefundResponse RefundResponse
type MerchantMetadata ¶
type PaymentDetails ¶
type PaymentDetails struct { PaymentIntent string `json:"paymentIntent,omitempty"` CanHandlePendingAuthorization *bool `json:"canHandlePendingAuthorization,omitempty"` ChargeAmount *Price `json:"chargeAmount,omitempty"` TotalOrderAmount *Price `json:"totalOrderAmount,omitempty"` SoftDescriptor string `json:"softDescriptor,omitempty"` PresentmentCurrency string `json:"presentmentCurrency,omitempty"` AllowOvercharge *bool `json:"allowOvercharge,omitempty"` ExtendExpiration *bool `json:"extendExpiration,omitempty"` }
type PaymentPreference ¶
type PaymentPreference struct {
PaymentDescriptor string `json:"paymentDescriptor,omitempty"`
}
type ProviderMetadata ¶
type ProviderMetadata struct {
ProviderReferenceID string `json:"providerReferenceId,omitempty"`
}
type RecurringMetadata ¶
type RefundResponse ¶
type RefundResponse struct { ErrorResponse RefundID string `json:"refundId,omitempty"` ChargeID string `json:"chargeId,omitempty"` RefundAmount *Price `json:"refundAmount,omitempty"` SoftDescriptor string `json:"softDescriptor,omitempty"` CreationTimestamp string `json:"creationTimestamp,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` ReleaseEnvironment string `json:"releaseEnvironment,omitempty"` }
type StatusDetails ¶
type StatusDetails struct { State string `json:"state,omitempty"` // https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/checkout-session.html#type-statusdetails ReasonCode string `json:"reasonCode,omitempty"` ReasonDescription string `json:"reasonDescription,omitempty"` // https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge-permission.html#type-statusdetails Reasons []Reason `json:"reasons,omitempty"` LastUpdatedTimestamp string `json:"lastUpdatedTimestamp,omitempty"` }
type UpdateCheckoutSessionRequest ¶
type UpdateCheckoutSessionRequest struct { WebCheckoutDetails *WebCheckoutDetails `json:"webCheckoutDetails,omitempty"` PaymentDetails *PaymentDetails `json:"paymentDetails,omitempty"` MerchantMetadata *MerchantMetadata `json:"merchantMetadata,omitempty"` }
type UpdateCheckoutSessionResponse ¶
type UpdateCheckoutSessionResponse CheckoutSessionResponse
type WebCheckoutDetails ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.