Documentation
¶
Index ¶
- Constants
- type AccessToken
- type Address
- type Amount
- type AuthenticationResult
- type Authorization
- type Capture
- type Card
- type Client
- func (c *Client) CreateOrder(ctx context.Context, bm gopay.BodyMap) (ppRsp *CreateOrderRsp, err error)
- func (c *Client) GetAccessToken() (token *AccessToken, err error)
- func (c *Client) OrderAuthorize(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderAuthorizeRsp, err error)
- func (c *Client) OrderCapture(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderCaptureRsp, err error)
- func (c *Client) OrderDetail(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderDetailRsp, err error)
- func (c *Client) PaymentAuthorizeCapture(ctx context.Context, authorizationId string, bm gopay.BodyMap) (ppRsp *PaymentAuthorizeCaptureRsp, err error)
- func (c *Client) PaymentAuthorizeDetail(ctx context.Context, authorizationId string) (ppRsp *PaymentAuthorizeDetailRsp, err error)
- func (c *Client) PaymentAuthorizeVoid(ctx context.Context, authorizationId string) (ppRsp *EmptyRsp, err error)
- func (c *Client) PaymentCaptureDetail(ctx context.Context, captureId string) (ppRsp *PaymentCaptureDetailRsp, err error)
- func (c *Client) PaymentCaptureRefund(ctx context.Context, captureId string, bm gopay.BodyMap) (ppRsp *PaymentCaptureRefundRsp, err error)
- func (c *Client) PaymentReauthorize(ctx context.Context, authorizationId string, bm gopay.BodyMap) (ppRsp *PaymentReauthorizeRsp, err error)
- func (c *Client) PaymentRefundDetail(ctx context.Context, refundId string) (ppRsp *PaymentRefundDetailRsp, err error)
- func (c *Client) UpdateOrder(ctx context.Context, orderId string, patchs []*Patch) (ppRsp *EmptyRsp, err error)
- type CreateOrderRsp
- type DisputeCategory
- type EmptyRsp
- type ErrorDetail
- type ErrorResponse
- type ExchangeRate
- type Item
- type Link
- type Name
- type NetAmountBreakdown
- type OrderAuthorizeRsp
- type OrderCaptureRsp
- type OrderDetail
- type OrderDetailRsp
- type Patch
- type Payee
- type Payer
- type PaymentAuthorizeCapture
- type PaymentAuthorizeCaptureRsp
- type PaymentAuthorizeDetail
- type PaymentAuthorizeDetailRsp
- type PaymentCaptureDetailRsp
- type PaymentCaptureRefund
- type PaymentCaptureRefundRsp
- type PaymentInstruction
- type PaymentReauthorizeRsp
- type PaymentRefundDetailRsp
- type PaymentSource
- type Payments
- type PlatformFee
- type Processor
- type PurchaseUnit
- type Refund
- type SellerPayableBreakdown
- type SellerProtection
- type SellerReceivableBreakdown
- type Shipping
- type StatusDetails
- type ThreeDSecure
Constants ¶
View Source
const ( Success = 0 HeaderAuthorization = "Authorization" // 请求头Auth AuthorizationPrefixBasic = "Basic " AuthorizationPrefixBearer = "Bearer " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AuthenticationResult ¶
type AuthenticationResult struct { LiabilityShift string `json:"liability_shift"` ThreeDSecure *ThreeDSecure `json:"three_d_secure,omitempty"` }
type Authorization ¶
type Authorization struct {
ProcessorResponse *Processor `json:"processor_response,omitempty"`
}
type Capture ¶
type Capture struct { Status string `json:"status,omitempty"` StatusDetails *StatusDetails `json:"status_details,omitempty"` }
type Card ¶
type Card struct { Name string `json:"name"` BillingAddress *Address `json:"billing_address,omitempty"` LastDigits string `json:"last_digits"` Brand string `json:"brand"` Type string `json:"type"` // The payment card type:CREDIT、DEBIT、PREPAID、UNKNOWN AuthenticationResult *AuthenticationResult `json:"authentication_result,omitempty"` }
type Client ¶
type Client struct { Clientid string Secret string Appid string AccessToken string ExpiresIn int IsProd bool DebugSwitch gopay.DebugSwitch // contains filtered or unexported fields }
Client PayPal支付客
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(ctx context.Context, bm gopay.BodyMap) (ppRsp *CreateOrderRsp, err error)
创建订单(Create order)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/orders/v2/#orders_create
func (*Client) GetAccessToken ¶
func (c *Client) GetAccessToken() (token *AccessToken, err error)
获取AccessToken(Get an access token)
文档:https://developer.paypal.com/docs/api/reference/get-an-access-token
func (*Client) OrderAuthorize ¶
func (c *Client) OrderAuthorize(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderAuthorizeRsp, err error)
订单支付授权(Authorize payment for order)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/orders/v2/#orders_authorize
func (*Client) OrderCapture ¶
func (c *Client) OrderCapture(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderCaptureRsp, err error)
订单支付捕获(Capture payment for order)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/orders/v2/#orders_capture
func (*Client) OrderDetail ¶
func (c *Client) OrderDetail(ctx context.Context, orderId string, bm gopay.BodyMap) (ppRsp *OrderDetailRsp, err error)
订单详情(Show order details)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/orders/v2/#orders_get
func (*Client) PaymentAuthorizeCapture ¶
func (c *Client) PaymentAuthorizeCapture(ctx context.Context, authorizationId string, bm gopay.BodyMap) (ppRsp *PaymentAuthorizeCaptureRsp, err error)
支付授权捕获(Capture authorized payment)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#authorizations_capture
func (*Client) PaymentAuthorizeDetail ¶
func (c *Client) PaymentAuthorizeDetail(ctx context.Context, authorizationId string) (ppRsp *PaymentAuthorizeDetailRsp, err error)
支付授权详情(Show details for authorized payment)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#authorizations_get
func (*Client) PaymentAuthorizeVoid ¶
func (c *Client) PaymentAuthorizeVoid(ctx context.Context, authorizationId string) (ppRsp *EmptyRsp, err error)
作废支付授权(Void authorized payment)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#authorizations_void
func (*Client) PaymentCaptureDetail ¶
func (c *Client) PaymentCaptureDetail(ctx context.Context, captureId string) (ppRsp *PaymentCaptureDetailRsp, err error)
支付捕获详情(Show captured payment details)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#captures_get
func (*Client) PaymentCaptureRefund ¶
func (c *Client) PaymentCaptureRefund(ctx context.Context, captureId string, bm gopay.BodyMap) (ppRsp *PaymentCaptureRefundRsp, err error)
支付捕获退款(Refund captured payment)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#captures_refund
func (*Client) PaymentReauthorize ¶
func (c *Client) PaymentReauthorize(ctx context.Context, authorizationId string, bm gopay.BodyMap) (ppRsp *PaymentReauthorizeRsp, err error)
重新授权支付授权(Reauthorize authorized payment)
Note:This request is currently not supported for Partner use cases. 文档:https://developer.paypal.com/docs/api/payments/v2/#authorizations_reauthorize
func (*Client) PaymentRefundDetail ¶
func (c *Client) PaymentRefundDetail(ctx context.Context, refundId string) (ppRsp *PaymentRefundDetailRsp, err error)
支付退款详情(Show refund details)
Code = 0 is success 文档:https://developer.paypal.com/docs/api/payments/v2/#refunds_get
type CreateOrderRsp ¶
type CreateOrderRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *OrderDetail `json:"response,omitempty"` }
type DisputeCategory ¶
type DisputeCategory struct {
DisputeCategory string `json:"dispute_category,omitempty"`
}
type EmptyRsp ¶
type EmptyRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` }
type ErrorDetail ¶
type ErrorResponse ¶
type ErrorResponse struct { Name string `json:"name,omitempty"` Message string `json:"message,omitempty"` DebugId string `json:"debug_id,omitempty"` Details []ErrorDetail `json:"details,omitempty"` Links []Link `json:"links,omitempty"` }
type ExchangeRate ¶
type Item ¶
type Item struct { Name string `json:"name,omitempty"` UnitAmount *Amount `json:"unit_amount,omitempty"` Tax *Amount `json:"tax,omitempty"` Quantity string `json:"quantity,omitempty"` Description string `json:"description,omitempty"` Sku string `json:"sku,omitempty"` Category string `json:"category,omitempty"` }
type NetAmountBreakdown ¶
type NetAmountBreakdown struct { PayableAmount *Amount `json:"payable_amount,omitempty"` ConvertedAmount *Amount `json:"converted_amount,omitempty"` ExchangeRate *ExchangeRate `json:"exchange_rate,omitempty"` }
type OrderAuthorizeRsp ¶
type OrderAuthorizeRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *OrderDetail `json:"response,omitempty"` }
type OrderCaptureRsp ¶
type OrderCaptureRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *OrderDetail `json:"response,omitempty"` }
type OrderDetail ¶
type OrderDetail struct { Id string `json:"id,omitempty"` PaymentSource *PaymentSource `json:"payment_source,omitempty"` Intent string `json:"intent,omitempty"` Payer *Payer `json:"payer,omitempty"` PurchaseUnits []*PurchaseUnit `json:"purchase_units,omitempty"` Status string `json:"status,omitempty"` // CREATED、SAVED、APPROVED、VOIDED、COMPLETED、PAYER_ACTION_REQUIRED Links []*Link `json:"links,omitempty"` CreateTime string `json:"create_time,omitempty"` UpdateTime string `json:"update_time,omitempty"` }
type OrderDetailRsp ¶
type OrderDetailRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *OrderDetail `json:"response,omitempty"` }
type PaymentAuthorizeCapture ¶
type PaymentAuthorizeCapture struct { Id string `json:"id,omitempty"` Status string `json:"status,omitempty"` // COMPLETED、DECLINED、PARTIALLY_REFUNDED、PENDING、REFUNDED、FAILED StatusDetails *StatusDetails `json:"status_details,omitempty"` Amount *Amount `json:"amount,omitempty"` InvoiceId string `json:"invoice_id,omitempty"` CustomId string `json:"custom_id,omitempty"` SellerProtection *SellerProtection `json:"seller_protection,omitempty"` FinalCapture bool `json:"final_capture,omitempty"` SellerReceivableBreakdown *SellerReceivableBreakdown `json:"seller_receivable_breakdown,omitempty"` DisbursementMode string `json:"disbursement_mode,omitempty"` Links []*Link `json:"links,omitempty"` ProcessorResponse *Processor `json:"processor_response,omitempty"` CreateTime string `json:"create_time,omitempty"` UpdateTime string `json:"update_time,omitempty"` }
type PaymentAuthorizeCaptureRsp ¶
type PaymentAuthorizeCaptureRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *PaymentAuthorizeCapture `json:"response,omitempty"` }
type PaymentAuthorizeDetail ¶
type PaymentAuthorizeDetail struct { Id string `json:"id,omitempty"` Status string `json:"status,omitempty"` // CREATED、CAPTURED、DENIED、EXPIRED、PARTIALLY_CAPTURED、PARTIALLY_CREATED、VOIDED、PENDING StatusDetails *StatusDetails `json:"status_details,omitempty"` Amount *Amount `json:"amount,omitempty"` InvoiceId string `json:"invoice_id,omitempty"` CustomId string `json:"custom_id,omitempty"` SellerProtection *SellerProtection `json:"seller_protection,omitempty"` Links []*Link `json:"links,omitempty"` ExpirationTime string `json:"expiration_time,omitempty"` CreateTime string `json:"create_time,omitempty"` UpdateTime string `json:"update_time,omitempty"` }
type PaymentAuthorizeDetailRsp ¶
type PaymentAuthorizeDetailRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *PaymentAuthorizeDetail `json:"response,omitempty"` }
type PaymentCaptureDetailRsp ¶
type PaymentCaptureDetailRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *PaymentAuthorizeCapture `json:"response,omitempty"` }
type PaymentCaptureRefund ¶
type PaymentCaptureRefund struct { Id string `json:"id,omitempty"` Status string `json:"status,omitempty"` // CANCELLED、PENDING、COMPLETED StatusDetails *StatusDetails `json:"status_details,omitempty"` Amount *Amount `json:"amount,omitempty"` InvoiceId string `json:"invoice_id,omitempty"` NoteToPayer string `json:"note_to_payer,omitempty"` SellerPayableBreakdown *SellerPayableBreakdown `json:"seller_payable_breakdown,omitempty"` Links []*Link `json:"links,omitempty"` CreateTime string `json:"create_time,omitempty"` UpdateTime string `json:"update_time,omitempty"` }
type PaymentCaptureRefundRsp ¶
type PaymentCaptureRefundRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *PaymentCaptureRefund `json:"response,omitempty"` }
type PaymentInstruction ¶
type PaymentInstruction struct { PlatformFees []*PlatformFee `json:"platform_fees,omitempty"` DisbursementMode string `json:"disbursement_mode,omitempty"` PayeePricingTierId string `json:"payee_pricing_tier_id,omitempty"` }
type PaymentReauthorizeRsp ¶
type PaymentReauthorizeRsp struct {}
type PaymentRefundDetailRsp ¶
type PaymentRefundDetailRsp struct { Code int `json:"-"` Error string `json:"-"` ErrorResponse *ErrorResponse `json:"-"` Response *PaymentCaptureRefund `json:"response,omitempty"` }
type PaymentSource ¶
type PaymentSource struct {
Card *Card `json:"card,omitempty"`
}
type Payments ¶
type Payments struct { Authorizations []*Authorization `json:"authorizations"` Captures []*Capture `json:"captures"` Refunds []*Refund `json:"refunds"` }
type PlatformFee ¶
type PurchaseUnit ¶
type PurchaseUnit struct { ReferenceId string `json:"reference_id,omitempty"` Amount *Amount `json:"amount,omitempty"` Payee *Payee `json:"payee,omitempty"` PaymentInstruction *PaymentInstruction `json:"payment_instruction,omitempty"` Description string `json:"description,omitempty"` CustomId string `json:"custom_id,omitempty"` InvoiceId string `json:"invoice_id,omitempty"` Id string `json:"id,omitempty"` SoftDescriptor string `json:"soft_descriptor,omitempty"` Items []*Item `json:"items,omitempty"` Shipping *Shipping `json:"shipping,omitempty"` Payments *Payments `json:"payments,omitempty"` }
type Refund ¶
type Refund struct { Status string `json:"status,omitempty"` StatusDetails *StatusDetails `json:"status_details,omitempty"` }
type SellerPayableBreakdown ¶
type SellerPayableBreakdown struct { GrossAmount *Amount `json:"gross_amount"` PaypalFee *Amount `json:"paypal_fee,omitempty"` PaypalFeeInReceivableCurrency *Amount `json:"paypal_fee_in_receivable_currency,omitempty"` NetAmount *Amount `json:"net_amount,omitempty"` NetAmountInReceivableCurrency *Amount `json:"net_amount_in_receivable_currency,omitempty"` PlatformFees []*PlatformFee `json:"platform_fees,omitempty"` NetAmountBreakdown []*NetAmountBreakdown `json:"net_amount_breakdown,omitempty"` TotalRefundedAmount *Amount `json:"total_refunded_amount,omitempty"` }
type SellerProtection ¶
type SellerProtection struct { Status string `json:"status,omitempty"` // ELIGIBLE、PARTIALLY_ELIGIBLE、NOT_ELIGIBLE DisputeCategories []*DisputeCategory `json:"dispute_categories,omitempty"` }
type SellerReceivableBreakdown ¶
type SellerReceivableBreakdown struct { GrossAmount *Amount `json:"gross_amount"` PaypalFee *Amount `json:"paypal_fee,omitempty"` PaypalFeeInReceivableCurrency *Amount `json:"paypal_fee_in_receivable_currency,omitempty"` NetAmount *Amount `json:"net_amount,omitempty"` ReceivableAmount *Amount `json:"receivable_amount,omitempty"` ExchangeRate *ExchangeRate `json:"exchange_rate,omitempty"` PlatformFees []*PlatformFee `json:"platform_fees,omitempty"` }
type StatusDetails ¶
type StatusDetails struct {
Reason string `json:"reason"`
}
type ThreeDSecure ¶
Click to show internal directories.
Click to hide internal directories.