Documentation
¶
Overview ¶
Package deepayment is the Go SDK for the merchant open API.
Requests are signed with the merchant's Ed25519 key using RFC 9421 HTTP Message Signatures; POST bodies are sealed to the platform's X25519 public key (libsodium sealed box). Signing, digesting and sealing are handled transparently; callers deal with typed requests and responses.
c, err := deepayment.NewClient(deepayment.Config{
BaseURL: "https://panama.deepayment.com",
AccessKey: "mak_live_xxx",
MerchantPrivateKeyBase64: merchantPrivateKey,
PlatformBodyKeyID: "body_20260827_01",
PlatformBodyPublicKeyBase64: platformBodyPublicKey,
PlatformWebhookPublicKeys: platformWebhookPublicKeys,
})
order, err := c.CreatePayment(ctx, &deepayment.CreatePaymentReq{...})
Amounts, balances, fees and rates are decimal strings, never JSON numbers. Write APIs are not retried automatically; recover from timeouts by querying the order via merchantOrderNo or orderNo. A deliberate retry reuses the same merchantOrderNo, which is the only key the platform deduplicates on; the idempotency key is carried for tracing only. The wire protocol is documented under protocol/ and the shared conformance vectors under protocol/testdata.
Index ¶
- Constants
- Variables
- type APIError
- type AddExtraInfoResult
- type Balance
- type CheckoutParams
- type Client
- func (c *Client) AddPaymentExtraInfo(ctx context.Context, orderNo, payMethod string, extra map[string]string) (*AddExtraInfoResult, error)
- func (c *Client) CreatePayment(ctx context.Context, req *CreatePaymentReq, opts ...RequestOption) (*PaymentOrder, error)
- func (c *Client) CreatePayout(ctx context.Context, req *CreatePayoutReq, opts ...RequestOption) (*PayoutOrder, error)
- func (c *Client) GetBalance(ctx context.Context, currency string) (*Balance, error)
- func (c *Client) GetPaymentCheckout(ctx context.Context, orderNo string) (*PaymentCheckout, error)
- func (c *Client) GetPayoutReceipt(ctx context.Context, orderNo string) (*PayoutReceipt, error)
- func (c *Client) GetUSDRate(ctx context.Context, currency, payMethod string) (*USDRate, error)
- func (c *Client) ParsePaymentWebhook(r *http.Request) (*PaymentWebhook, error)
- func (c *Client) ParsePayoutWebhook(r *http.Request) (*PayoutWebhook, error)
- func (c *Client) QueryPaymentByMerchantOrderNo(ctx context.Context, merchantOrderNo string) (*PaymentOrder, error)
- func (c *Client) QueryPaymentByOrderNo(ctx context.Context, orderNo string) (*PaymentOrder, error)
- func (c *Client) QueryPayoutByMerchantOrderNo(ctx context.Context, merchantOrderNo string) (*PayoutOrder, error)
- func (c *Client) QueryPayoutByOrderNo(ctx context.Context, orderNo string) (*PayoutOrder, error)
- func (c *Client) SubmitPaymentTradeNo(ctx context.Context, orderNo, tradeNo string) (*SubmitTradeNoResult, error)
- func (c *Client) VerifyWebhook(r *http.Request) ([]byte, error)
- type Config
- type CreatePaymentReq
- type CreatePayoutReq
- type Option
- type OrderAction
- type PaymentAccountContactExtra
- type PaymentArsDocumentExtra
- type PaymentArsQrisExtra
- type PaymentBankAccountContactExtra
- type PaymentBankTransferExtra
- type PaymentBdWalletExtra
- type PaymentCheckout
- type PaymentCustomerDocumentContactExtra
- type PaymentCustomerDocumentEmailExtra
- type PaymentEWalletExtra
- type PaymentMethod
- type PaymentNequiExtra
- type PaymentOrder
- type PaymentPayer
- type PaymentPixExtra
- type PaymentPkWalletExtra
- type PaymentPseExtra
- type PaymentSpeiExtra
- type PaymentUsCustomerExtra
- type PaymentUsdtExtra
- type PaymentWebhook
- type PayoutAccountContactExtra
- type PayoutBankAccountContactExtra
- type PayoutBankTransferExtra
- type PayoutCashAppExtra
- type PayoutColombiaBankExtra
- type PayoutEWalletExtra
- type PayoutInIfscExtra
- type PayoutInUpiExtra
- type PayoutMethod
- type PayoutOrder
- type PayoutPaparaExtra
- type PayoutPixExtra
- type PayoutPkDfExtra
- type PayoutReceipt
- type PayoutRubBankExtra
- type PayoutTransfiyaExtra
- type PayoutUsdtExtra
- type PayoutWebhook
- type ReceiptAccount
- type ReceiptBank
- type RequestOption
- type ResponseError
- type SubmitTradeNoResult
- type USDRate
- type WebhookFailure
Examples ¶
Constants ¶
const ( StatusPending = "PENDING" StatusProcessing = "PROCESSING" StatusSucceeded = "SUCCEEDED" StatusFailed = "FAILED" StatusExpired = "EXPIRED" StatusCanceled = "CANCELED" StatusRefunded = "REFUNDED" )
Public order statuses. REFUNDED applies only to a returned payout after its refund has been credited; payment and checkout statuses are unchanged.
const ( CurrencyBRL = "BRL" CurrencyARS = "ARS" CurrencyMXN = "MXN" CurrencyCOP = "COP" CurrencyCLP = "CLP" CurrencyPEN = "PEN" CurrencyTRY = "TRY" CurrencyRUB = "RUB" CurrencyUSD = "USD" CurrencyBDT = "BDT" CurrencyIDR = "IDR" CurrencyPHP = "PHP" CurrencyPKR = "PKR" CurrencyTHB = "THB" CurrencyINR = "INR" )
Currency codes accepted by the API; unlisted values pass through unchanged.
const ( CountryBR = "BR" CountryAR = "AR" CountryMX = "MX" CountryCO = "CO" CountryCL = "CL" CountryPE = "PE" CountryTR = "TR" CountryRU = "RU" CountryUS = "US" CountryBD = "BD" CountryID = "ID" CountryPH = "PH" CountryPK = "PK" CountryTH = "TH" CountryIN = "IN" )
const ( MethodCodePIX = "PIX" MethodCodePagoFacil = "PAGO_FACIL" MethodCodeRapipago = "RAPIPAGO" MethodCodeBankTransfer = "BANK_TRANSFER" MethodCodeCVU = "CVU" MethodCodeQRIS = "QRIS" MethodCodeSPEI = "SPEI" MethodCodeOXXO = "OXXO" MethodCodeCash = "CASH" MethodCodePSE = "PSE" MethodCodeNequi = "NEQUI" MethodCodeTransfiya = "TRANSFIYA" MethodCodeBreb = "BREB" MethodCodeWebpay = "WEBPAY" MethodCodeKhipu = "KHIPU" MethodCodeMach = "MACH" MethodCodePago46 = "PAGO46" MethodCodeServiFacil = "SERVIFACIL" MethodCodeEWallet = "E_WALLET" MethodCodeCashApp = "CASH_APP" MethodCodePayPal = "PAYPAL" MethodCodeChime = "CHIME" MethodCodeCreditCard = "CREDIT_CARD" MethodCodeApplePay = "APPLE_PAY" MethodCodeGooglePay = "GOOGLE_PAY" MethodCodeNeteller = "NETELLER" MethodCodeSkrill = "SKRILL" MethodCodeUSDTTRC20 = "USDT-TRC20" MethodCodeUSDTERC20 = "USDT-ERC20" MethodCodeUSDTBEP20 = "USDT-BEP20" MethodCodeBDBkash = "BD_BKASH" MethodCodeBDNagad = "BD_NAGAD" MethodCodeIDVA = "ID_VA" MethodCodeIDQRIS = "ID_QRIS" MethodCodeIDDana = "ID_DANA" MethodCodeIDOvo = "ID_OVO" MethodCodeIDGopay = "ID_GOPAY" MethodCodeIDLinkaja = "ID_LINKAJA" MethodCodeIDShopeepay = "ID_SHOPEEPAY" MethodCodePHGcash = "PH_GCASH" MethodCodePHMaya = "PH_MAYA" MethodCodePHGrab = "PH_GRAB" MethodCodePHQRIS = "PH_QRIS" MethodCodePHGcashQR = "PH_GCASH_QR" MethodCodePHMayaQR = "PH_MAYA_QR" MethodCodePHNativeGcash = "PH_NATIVE_GCASH" MethodCodePKJazzcash = "PK_JAZZCASH" MethodCodePKEasypaisa = "PK_EASYPAISA" MethodCodePKJazzcashQrph = "PK_JAZZCASH_QRPH" MethodCodePKEasypaisaQrph = "PK_EASYPAISA_QRPH" MethodCodeTHBankCard = "TH_BANK_CARD" MethodCodeTHTruemoney = "TH_TRUEMONEY" MethodCodeTHPromptpay = "TH_PROMPTPAY" MethodCodeBankCard = "BANK_CARD" MethodCodePapara = "PAPARA" MethodCodeP2P = "P2P" MethodCodeSBP = "SBP" MethodCodeIDBankTransfer = "ID_BANK_TRANSFER" MethodCodePHDfWallet = "PH_DF_WALLET" MethodCodePHDfBank = "PH_DF_BANK" MethodCodePKBank = "PK_BANK" MethodCodeTHBankTransfer = "TH_BANK_TRANSFER" MethodCodeINIFSC = "IN_IFSC" MethodCodeINUPI = "IN_UPI" )
PaymentMethod.Code / PayoutMethod.Code values. Pay-in and pay-out share one namespace; unlisted values pass through unchanged.
const ( MsgInvalidField = "INVALID_FIELD" MsgUnsupportedCurrency = "UNSUPPORTED_CURRENCY" MsgUnsupportedMethod = "UNSUPPORTED_METHOD" MsgInsufficientBalance = "INSUFFICIENT_BALANCE" MsgMethodNotEnabled = "METHOD_NOT_ENABLED" MsgOrderNotFound = "ORDER_NOT_FOUND" MsgIdempotencyConflict = "IDEMPOTENCY_CONFLICT" MsgRateLimited = "RATE_LIMITED" MsgInternalError = "INTERNAL_ERROR" MsgOrderRejected = "ORDER_REJECTED" MsgChannelError = "CHANNEL_ERROR" MsgChannelBusy = "CHANNEL_BUSY" )
Machine-readable error identifiers from the gateway's envelope "msg" field. Open set; treat unknown values as opaque strings.
const ( WebhookOrderTypePayment = "PAYMENT" WebhookOrderTypePayout = "PAYOUT" )
Variables ¶
var ( ErrMissingBaseURL = errors.New("sdk: Config.BaseURL is required") ErrInvalidBaseURL = errors.New("sdk: Config.BaseURL must be an absolute origin URL") ErrMissingAccessKey = errors.New("sdk: Config.AccessKey is required") ErrNilRequest = fmt.Errorf("%w: request is nil", ErrInvalidRequest) ErrInvalidPathParam = fmt.Errorf("%w: invalid path parameter", ErrInvalidRequest) ErrInvalidQueryParam = fmt.Errorf("%w: invalid query parameter", ErrInvalidRequest) ErrInvalidExtraField = fmt.Errorf("%w: invalid extra field name", ErrInvalidRequest) ErrResponseTooLarge = errors.New("sdk: response body exceeds MaxResponseBytes") // ErrTransport wraps failures after the request left the process (connect, // timeout, read). The outcome is unknown: query the order before retrying. ErrTransport = errors.New("sdk: transport") ErrInvalidWebhookBody = errors.New("sdk: invalid webhook body") ErrMissingMethodCode = fmt.Errorf("%w: paymentMethod.code is required", ErrInvalidRequest) ErrConflictingMethodExtra = fmt.Errorf("%w: only one method extra may be set", ErrInvalidRequest) ErrMethodExtraMismatch = fmt.Errorf("%w: method extra does not match code", ErrInvalidRequest) ErrMethodNotAvailable = fmt.Errorf("%w: method is not available for this currency", ErrInvalidRequest) ErrMissingRequiredField = fmt.Errorf("%w: required field is empty", ErrInvalidRequest) ErrInvalidAmount = fmt.Errorf("%w: amount must be a positive decimal string", ErrInvalidRequest) ErrInvalidWebhookURL = fmt.Errorf("%w: webhookUrl must be an absolute https URL", ErrInvalidRequest) ErrMissingMerchantPrivateKey = errors.New("sdk: Config.MerchantPrivateKeyBase64 is required") ErrMissingPlatformBodyKeyID = errors.New("sdk: Config.PlatformBodyKeyID is required") ErrMissingPlatformBodyPublicKey = errors.New("sdk: Config.PlatformBodyPublicKeyBase64 is required") ErrMissingPlatformWebhookPublicKeys = errors.New("sdk: Config.PlatformWebhookPublicKeys is required") ErrInvalidMerchantPrivateKey = errors.New("sdk: invalid merchant Ed25519 private key") ErrInvalidPlatformBodyPublicKey = errors.New("sdk: invalid platform X25519 public key") ErrInvalidPlatformWebhookPublicKey = errors.New("sdk: invalid platform webhook Ed25519 public key") ErrInvalidIdempotencyKey = fmt.Errorf("%w: invalid Idempotency-Key", ErrInvalidRequest) ErrWebhookPlatformKeyNotFound = errors.New("sdk: webhook platform key not found") ErrWebhookEventIDMismatch = errors.New("sdk: webhook event id mismatch") ErrSignedPostQueryNotAllowed = fmt.Errorf("%w: signed POST query is not allowed", ErrInvalidRequest) ErrSignedGetBodyNotAllowed = fmt.Errorf("%w: signed GET body is not allowed", ErrInvalidRequest) ErrSignedMethodNotSupported = fmt.Errorf("%w: signed method is not supported", ErrInvalidRequest) )
var ErrInvalidRequest = errors.New("sdk: invalid request")
ErrInvalidRequest is the parent of every error raised before a request leaves the process.
A single errors.Is(err, ErrInvalidRequest) separates two failures with opposite handling: a match means the request was never sent and the upstream cannot have accepted it, so the caller may safely mark it failed; anything else (network, timeout, non-envelope response) leaves the outcome unknown, and a payout is never marked failed on it. Treating "never sent" as "unknown" strands a payout in pending, waiting for an upstream order that does not exist: no query and no webhook will ever settle it.
Every error raised before sending wraps this sentinel with %w; an unwrapped one is silently classified by integrators as an unknown outcome.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
HTTPStatus int
Code int
Msg string
Message string
TraceID string
RawBody []byte
}
APIError is the typed business error decoded from a non-success envelope.
func AsAPIError ¶
type AddExtraInfoResult ¶
type AddExtraInfoResult struct {
Status int64 `json:"status"`
// OrderStatus is the checkout-facing order status (CREATED / PENDING / …).
OrderStatus string `json:"orderStatus,omitempty"`
// PaymentUrl is set once the platform placed the order upstream; the payer
// is redirected there.
PaymentUrl string `json:"paymentUrl,omitempty"`
Message string `json:"message,omitempty"`
}
AddExtraInfoResult is the answer to AddPaymentExtraInfo; like SubmitTradeNoResult it reports acceptance through Status, not through the error.
func (*AddExtraInfoResult) Ok ¶
func (r *AddExtraInfoResult) Ok() bool
Ok reports whether the platform accepted the extra info.
type Balance ¶
type Balance struct {
Currency string `json:"currency"`
Balance string `json:"balance"`
LockBalance string `json:"lockBalance"`
PaymentBalance string `json:"paymentBalance"`
PaymentLockBalance string `json:"paymentLockBalance"`
PayoutBalance string `json:"payoutBalance"`
PayoutLockBalance string `json:"payoutLockBalance"`
}
type CheckoutParams ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddPaymentExtraInfo ¶
func (c *Client) AddPaymentExtraInfo(ctx context.Context, orderNo, payMethod string, extra map[string]string) (*AddExtraInfoResult, error)
AddPaymentExtraInfo completes a "create first, fill in later" order: the merchant may create the payment without payer details, and the H5 checkout page supplies them here, which is what triggers the real upstream order. payMethod and extra may be empty when the order already carries them. Unsigned and unencrypted like SubmitPaymentTradeNo; a nil error is not acceptance, see AddExtraInfoResult.
func (*Client) CreatePayment ¶
func (c *Client) CreatePayment(ctx context.Context, req *CreatePaymentReq, opts ...RequestOption) (*PaymentOrder, error)
func (*Client) CreatePayout ¶
func (c *Client) CreatePayout(ctx context.Context, req *CreatePayoutReq, opts ...RequestOption) (*PayoutOrder, error)
func (*Client) GetBalance ¶
func (*Client) GetPaymentCheckout ¶
GetPaymentCheckout is unsigned and unencrypted; /api/v1/payment/checkout is a public endpoint used by the H5 checkout page and callable by the merchant backend for reconciliation.
func (*Client) GetPayoutReceipt ¶
func (*Client) GetUSDRate ¶
func (*Client) ParsePaymentWebhook ¶
func (c *Client) ParsePaymentWebhook(r *http.Request) (*PaymentWebhook, error)
func (*Client) ParsePayoutWebhook ¶
func (c *Client) ParsePayoutWebhook(r *http.Request) (*PayoutWebhook, error)
func (*Client) QueryPaymentByMerchantOrderNo ¶
func (*Client) QueryPaymentByOrderNo ¶
func (*Client) QueryPayoutByMerchantOrderNo ¶
func (*Client) QueryPayoutByOrderNo ¶
func (*Client) SubmitPaymentTradeNo ¶
func (c *Client) SubmitPaymentTradeNo(ctx context.Context, orderNo, tradeNo string) (*SubmitTradeNoResult, error)
SubmitPaymentTradeNo reports the upstream trade number (UTR) a payer typed into the H5 checkout page, so the platform can match the transfer to the order. Like GetPaymentCheckout it is unsigned and unencrypted, plain JSON both ways: the endpoint serves the merchant's own H5 checkout page, which has no access to the merchant private key. A nil error is not acceptance; see SubmitTradeNoResult.
type Config ¶
type Config struct {
// Scheme and host of the platform API, https only. A path, query or fragment
// is rejected: the SDK appends the endpoint path itself.
BaseURL string
AccessKey string
// Ed25519 private key, base64. Both forms are accepted: the 32-byte seed that
// libsodium and OpenSSL hand out, and Go's 64-byte seed-plus-public-key.
MerchantPrivateKeyBase64 string
// Names which platform key seals the request body; it travels in the envelope
// so the gateway knows which private key opens it. Must name the key given in
// PlatformBodyPublicKeyBase64.
PlatformBodyKeyID string
// Platform X25519 public key, base64, 32 bytes. Not the webhook key: that one
// is Ed25519 and verifies signatures in the opposite direction.
PlatformBodyPublicKeyBase64 string
// Key id to platform Ed25519 public key, base64, 32 bytes each, for verifying
// webhook signatures. The webhook names its key id, so this must hold every key
// the platform may currently sign with; during a rotation that is two. Required
// even when the merchant does not consume webhooks.
PlatformWebhookPublicKeys map[string]string
// Setting HTTPClient ignores Timeout, which only builds the default client.
HTTPClient *http.Client
Timeout time.Duration // default 30s
UserAgent string
AcceptLanguage string
MaxResponseBytes int64 // default 8 MiB
}
type CreatePaymentReq ¶
type CreatePaymentReq struct {
MerchantOrderNo string `json:"merchantOrderNo"`
Currency string `json:"currency"`
Amount string `json:"amount"`
Country string `json:"country,omitempty"`
PaymentMethod PaymentMethod `json:"paymentMethod"`
ReturnUrl string `json:"returnUrl,omitempty"`
WebhookUrl string `json:"webhookUrl"`
Attach string `json:"attach,omitempty"`
}
Example (Pen) ¶
These examples only build requests; they do not send payments. Replace all fictional identity and account details before using a real client.
methods := []PaymentMethod{
{
Code: MethodCodeBankTransfer,
BankTransfer: &PaymentBankTransferExtra{
CustomerName: "Test Payer", CustomerPhone: "912345678", CustomerEmail: "payer@example.test",
DocumentType: "DNI", DocumentNumber: "12345678",
},
},
{
Code: MethodCodeEWallet,
EWallet: &PaymentEWalletExtra{
CustomerName: "Test Payer", CustomerPhone: "912345678", CustomerEmail: "payer@example.test",
DocumentType: "DNI", DocumentNumber: "12345678",
},
},
{
Code: MethodCodeCash,
Cash: &PaymentCustomerDocumentContactExtra{
CustomerName: "Test Payer", CustomerPhone: "912345678", CustomerEmail: "payer@example.test",
DocumentType: "DNI", DocumentNumber: "12345678",
},
},
}
for i, method := range methods {
req := CreatePaymentReq{
MerchantOrderNo: fmt.Sprintf("pen-payment-example-%d", i+1),
Currency: CurrencyPEN, Country: "PE", Amount: "10.25",
PaymentMethod: method,
ReturnUrl: "https://merchant.example.test/return",
WebhookUrl: "https://merchant.example.test/webhook/payment",
}
body, err := json.Marshal(req)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
// After creation, redirect the payer to order.Action.Url.
// Opening or returning from that page does not confirm payment.
Output: {"merchantOrderNo":"pen-payment-example-1","currency":"PEN","amount":"10.25","country":"PE","paymentMethod":{"code":"BANK_TRANSFER","bankTransfer":{"customerName":"Test Payer","customerPhone":"912345678","customerEmail":"payer@example.test","documentType":"DNI","documentNumber":"12345678"}},"returnUrl":"https://merchant.example.test/return","webhookUrl":"https://merchant.example.test/webhook/payment"} {"merchantOrderNo":"pen-payment-example-2","currency":"PEN","amount":"10.25","country":"PE","paymentMethod":{"code":"E_WALLET","eWallet":{"customerName":"Test Payer","customerPhone":"912345678","customerEmail":"payer@example.test","documentType":"DNI","documentNumber":"12345678"}},"returnUrl":"https://merchant.example.test/return","webhookUrl":"https://merchant.example.test/webhook/payment"} {"merchantOrderNo":"pen-payment-example-3","currency":"PEN","amount":"10.25","country":"PE","paymentMethod":{"code":"CASH","cash":{"documentType":"DNI","documentNumber":"12345678","customerName":"Test Payer","customerPhone":"912345678","customerEmail":"payer@example.test"}},"returnUrl":"https://merchant.example.test/return","webhookUrl":"https://merchant.example.test/webhook/payment"}
type CreatePayoutReq ¶
type CreatePayoutReq struct {
MerchantOrderNo string `json:"merchantOrderNo"`
Currency string `json:"currency"`
Amount string `json:"amount"`
Country string `json:"country,omitempty"`
PayoutMethod PayoutMethod `json:"payoutMethod"`
WebhookUrl string `json:"webhookUrl"`
Attach string `json:"attach,omitempty"`
}
Example (Pen) ¶
methods := []PayoutMethod{
{
Code: MethodCodeBankTransfer,
BankTransfer: &PayoutBankTransferExtra{
DocumentType: "DNI", DocumentNumber: "12345678",
CustomerPhone: "912345678", CustomerEmail: "recipient@example.test",
AccountName: "Test Recipient", AccountNo: "00123456789",
AccountType: "SAVINGS", BankCode: "002", CciNo: "00212345678901234567",
},
},
{
Code: MethodCodeEWallet,
EWallet: &PayoutEWalletExtra{
DocumentType: "DNI", DocumentNumber: "12345678",
CustomerPhone: "912345678", CustomerEmail: "recipient@example.test",
AccountName: "Test Recipient", AccountNo: "912345678", BankCode: "026", // Yape
},
},
{
Code: MethodCodeEWallet,
EWallet: &PayoutEWalletExtra{
DocumentType: "DNI", DocumentNumber: "12345678",
CustomerPhone: "912345678", CustomerEmail: "recipient@example.test",
AccountName: "Test Recipient", AccountNo: "912345678", BankCode: "025", // Plin
},
},
}
for i, method := range methods {
req := CreatePayoutReq{
MerchantOrderNo: fmt.Sprintf("pen-payout-example-%d", i+1),
Currency: CurrencyPEN, Country: "PE", Amount: "10.25",
PayoutMethod: method,
WebhookUrl: "https://merchant.example.test/webhook/payout",
}
body, err := json.Marshal(req)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
// Account numbers and the bank CCI remain strings to preserve leading zeros.
// Wallet accountNo identifies the recipient; customerPhone is contact information.
Output: {"merchantOrderNo":"pen-payout-example-1","currency":"PEN","amount":"10.25","country":"PE","payoutMethod":{"code":"BANK_TRANSFER","bankTransfer":{"documentType":"DNI","documentNumber":"12345678","customerPhone":"912345678","customerEmail":"recipient@example.test","accountName":"Test Recipient","accountNo":"00123456789","accountType":"SAVINGS","bankCode":"002","cciNo":"00212345678901234567"}},"webhookUrl":"https://merchant.example.test/webhook/payout"} {"merchantOrderNo":"pen-payout-example-2","currency":"PEN","amount":"10.25","country":"PE","payoutMethod":{"code":"E_WALLET","eWallet":{"documentType":"DNI","documentNumber":"12345678","customerPhone":"912345678","customerEmail":"recipient@example.test","accountName":"Test Recipient","accountNo":"912345678","bankCode":"026"}},"webhookUrl":"https://merchant.example.test/webhook/payout"} {"merchantOrderNo":"pen-payout-example-3","currency":"PEN","amount":"10.25","country":"PE","payoutMethod":{"code":"E_WALLET","eWallet":{"documentType":"DNI","documentNumber":"12345678","customerPhone":"912345678","customerEmail":"recipient@example.test","accountName":"Test Recipient","accountNo":"912345678","bankCode":"025"}},"webhookUrl":"https://merchant.example.test/webhook/payout"}
func (CreatePayoutReq) MarshalJSON ¶ added in v0.3.0
func (r CreatePayoutReq) MarshalJSON() ([]byte, error)
type OrderAction ¶
type PaymentArsDocumentExtra ¶
type PaymentArsDocumentExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"` // Required for ARS CVU.
}
type PaymentArsQrisExtra ¶
type PaymentArsQrisExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
}
type PaymentBankTransferExtra ¶
type PaymentBankTransferExtra struct {
CustomerId string `json:"customerId,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Email string `json:"email,omitempty"`
}
type PaymentBdWalletExtra ¶
type PaymentCheckout ¶
type PaymentCheckout struct {
OrderNo string `json:"orderNo"`
OrderStatus int64 `json:"orderStatus"`
Status string `json:"status"`
Amount string `json:"amount"`
Currency string `json:"currency"`
PayMethod string `json:"payMethod"`
Attach string `json:"attach"`
ReturnUrl string `json:"returnUrl,omitempty"`
Params CheckoutParams `json:"params"`
CreateTime int64 `json:"createTime"`
UpdateTime int64 `json:"updateTime"`
}
type PaymentCustomerDocumentContactExtra ¶
type PaymentCustomerDocumentContactExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
}
type PaymentEWalletExtra ¶
type PaymentEWalletExtra struct {
CustomerId string `json:"customerId,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
}
type PaymentMethod ¶
type PaymentMethod struct {
Code string `json:"code"`
Pix *PaymentPixExtra `json:"pix,omitempty"`
PagoFacil *PaymentArsDocumentExtra `json:"pagoFacil,omitempty"`
Rapipago *PaymentArsDocumentExtra `json:"rapipago,omitempty"`
BankTransfer *PaymentBankTransferExtra `json:"bankTransfer,omitempty"`
Cvu *PaymentArsDocumentExtra `json:"cvu,omitempty"`
Qris *PaymentArsQrisExtra `json:"qris,omitempty"`
Spei *PaymentSpeiExtra `json:"spei,omitempty"`
Cash *PaymentCustomerDocumentContactExtra `json:"cash,omitempty"`
Pse *PaymentPseExtra `json:"pse,omitempty"`
Nequi *PaymentNequiExtra `json:"nequi,omitempty"`
Transfiya *PaymentCustomerDocumentContactExtra `json:"transfiya,omitempty"`
Breb *PaymentCustomerDocumentContactExtra `json:"breb,omitempty"`
Webpay *PaymentCustomerDocumentEmailExtra `json:"webpay,omitempty"`
Khipu *PaymentCustomerDocumentEmailExtra `json:"khipu,omitempty"`
Mach *PaymentCustomerDocumentEmailExtra `json:"mach,omitempty"`
Pago46 *PaymentCustomerDocumentEmailExtra `json:"pago46,omitempty"`
ServiFacil *PaymentCustomerDocumentEmailExtra `json:"serviFacil,omitempty"`
EWallet *PaymentEWalletExtra `json:"eWallet,omitempty"`
CashApp *PaymentUsCustomerExtra `json:"cashApp,omitempty"`
CreditCard *PaymentUsCustomerExtra `json:"creditCard,omitempty"`
ApplePay *PaymentUsCustomerExtra `json:"applePay,omitempty"`
GooglePay *PaymentUsCustomerExtra `json:"googlePay,omitempty"`
Neteller *PaymentUsCustomerExtra `json:"neteller,omitempty"`
Skrill *PaymentUsCustomerExtra `json:"skrill,omitempty"`
UsdtTrc20 *PaymentUsdtExtra `json:"usdtTrc20,omitempty"`
UsdtErc20 *PaymentUsdtExtra `json:"usdtErc20,omitempty"`
UsdtBep20 *PaymentUsdtExtra `json:"usdtBep20,omitempty"`
BdBkash *PaymentBdWalletExtra `json:"bdBkash,omitempty"`
BdNagad *PaymentBdWalletExtra `json:"bdNagad,omitempty"`
IdVa *PaymentBankAccountContactExtra `json:"idVa,omitempty"`
IdQris *PaymentBankAccountContactExtra `json:"idQris,omitempty"`
IdDana *PaymentBankAccountContactExtra `json:"idDana,omitempty"`
IdOvo *PaymentBankAccountContactExtra `json:"idOvo,omitempty"`
IdGopay *PaymentBankAccountContactExtra `json:"idGopay,omitempty"`
IdLinkaja *PaymentBankAccountContactExtra `json:"idLinkaja,omitempty"`
IdShopeepay *PaymentBankAccountContactExtra `json:"idShopeepay,omitempty"`
PhGcash *PaymentAccountContactExtra `json:"phGcash,omitempty"`
PhMaya *PaymentAccountContactExtra `json:"phMaya,omitempty"`
PhGrab *PaymentAccountContactExtra `json:"phGrab,omitempty"`
PhQris *PaymentAccountContactExtra `json:"phQris,omitempty"`
PhGcashQr *PaymentAccountContactExtra `json:"phGcashQr,omitempty"`
PhMayaQr *PaymentAccountContactExtra `json:"phMayaQr,omitempty"`
PhNativeGcash *PaymentAccountContactExtra `json:"phNativeGcash,omitempty"`
PkJazzcash *PaymentPkWalletExtra `json:"pkJazzcash,omitempty"`
PkEasypaisa *PaymentPkWalletExtra `json:"pkEasypaisa,omitempty"`
PkJazzcashQrph *PaymentPkWalletExtra `json:"pkJazzcashQrph,omitempty"`
PkEasypaisaQrph *PaymentPkWalletExtra `json:"pkEasypaisaQrph,omitempty"`
ThBankCard *PaymentBankAccountContactExtra `json:"thBankCard,omitempty"`
ThTruemoney *PaymentBankAccountContactExtra `json:"thTruemoney,omitempty"`
ThPromptpay *PaymentBankAccountContactExtra `json:"thPromptpay,omitempty"`
InUpi *PaymentAccountContactExtra `json:"inUpi,omitempty"`
// contains filtered or unexported fields
}
PaymentMethod holds strongly-typed fields for every current payment method branch. For a method not yet in a release, wire it at runtime via SetExtra("xxx", payload).
func (PaymentMethod) MarshalJSON ¶
func (m PaymentMethod) MarshalJSON() ([]byte, error)
type PaymentNequiExtra ¶
type PaymentNequiExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
AccountNo string `json:"accountNo,omitempty"`
}
type PaymentOrder ¶
type PaymentOrder struct {
OrderNo string `json:"orderNo"`
MerchantOrderNo string `json:"merchantOrderNo"`
Status string `json:"status"`
Currency string `json:"currency"`
Amount string `json:"amount"`
PaidAmount string `json:"paidAmount"`
Payer *PaymentPayer `json:"payer,omitempty"`
Country string `json:"country,omitempty"`
PaymentMethod string `json:"paymentMethod"`
Action OrderAction `json:"action"`
Attach string `json:"attach,omitempty"`
Failure *WebhookFailure `json:"failure,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type PaymentPayer ¶ added in v0.5.0
type PaymentPayer struct {
Name string `json:"name,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
}
PaymentPayer is reported by the channel, not copied from the create request. It is available in authenticated payment queries and payment webhooks.
type PaymentPixExtra ¶
type PaymentPkWalletExtra ¶
type PaymentPseExtra ¶
type PaymentPseExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
BankCode string `json:"bankCode,omitempty"`
}
type PaymentSpeiExtra ¶
type PaymentSpeiExtra struct {
AllowMultiplePayments bool `json:"allowMultiplePayments,omitempty"`
MinAmount string `json:"minAmount,omitempty"`
MaxAmount string `json:"maxAmount,omitempty"`
}
PaymentSpeiExtra holds the MXN SPEI pay-in extra fields.
The amount mode is set by MinAmount / MaxAmount, orthogonal to AllowMultiplePayments:
- both 0: fixed amount; the settled amount equals CreatePaymentReq.Amount.
- both > 0: range amount; the settled amount is reported in PaidAmount.
AllowMultiplePayments controls whether one pay-in entry accepts multiple valid payments (default false).
type PaymentUsCustomerExtra ¶
type PaymentUsdtExtra ¶
type PaymentUsdtExtra struct {
CustomerId string `json:"customerId,omitempty"`
}
type PaymentWebhook ¶
type PaymentWebhook struct {
EventID string `json:"eventId"`
OrderType string `json:"orderType"`
OrderNo string `json:"orderNo"`
MerchantOrderNo string `json:"merchantOrderNo"`
Status string `json:"status"`
Currency string `json:"currency"`
Amount string `json:"amount"`
PaidAmount string `json:"paidAmount,omitempty"`
Payer *PaymentPayer `json:"payer,omitempty"`
ChannelTradeNo string `json:"channelTradeNo,omitempty"`
Attach string `json:"attach,omitempty"`
Failure *WebhookFailure `json:"failure,omitempty"`
}
type PayoutBankTransferExtra ¶
type PayoutBankTransferExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Name string `json:"name,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
Address string `json:"address,omitempty"`
AccountName string `json:"accountName,omitempty"`
AccountNo string `json:"accountNo,omitempty"`
AccountType string `json:"accountType,omitempty"`
BankCode string `json:"bankCode,omitempty"`
BankName string `json:"bankName,omitempty"`
CciNo string `json:"cciNo,omitempty"`
}
type PayoutCashAppExtra ¶
type PayoutCashAppExtra struct {
Name string `json:"name,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
AccountNo string `json:"accountNo,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
DateOfBirth string `json:"dateOfBirth,omitempty"`
CountryOfResidence string `json:"countryOfResidence,omitempty"`
StateOfResidence string `json:"stateOfResidence,omitempty"`
CardCity string `json:"cardCity,omitempty"`
CardStreet string `json:"cardStreet,omitempty"`
CardPostCode string `json:"cardPostCode,omitempty"`
}
PayoutCashAppExtra is shared by USD Cash App, PayPal and Chime payouts. cardCity, cardStreet and cardPostCode describe the recipient address, not a card.
type PayoutColombiaBankExtra ¶
type PayoutColombiaBankExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
AccountNo string `json:"accountNo,omitempty"`
BankName string `json:"bankName,omitempty"`
BankCode string `json:"bankCode,omitempty"`
AccountType string `json:"accountType,omitempty"`
}
type PayoutEWalletExtra ¶
type PayoutEWalletExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
AccountName string `json:"accountName,omitempty"`
AccountNo string `json:"accountNo,omitempty"`
BankCode string `json:"bankCode,omitempty"`
}
type PayoutInIfscExtra ¶
type PayoutInUpiExtra ¶
type PayoutMethod ¶
type PayoutMethod struct {
Code string `json:"code"`
Pix *PayoutPixExtra `json:"pix,omitempty"`
BankTransfer *PayoutBankTransferExtra `json:"bankTransfer,omitempty"`
Breb *PayoutColombiaBankExtra `json:"breb,omitempty"`
BankCard *PayoutColombiaBankExtra `json:"bankCard,omitempty"`
Transfiya *PayoutTransfiyaExtra `json:"transfiya,omitempty"`
Papara *PayoutPaparaExtra `json:"papara,omitempty"`
CashApp *PayoutCashAppExtra `json:"cashApp,omitempty"`
PayPal *PayoutCashAppExtra `json:"paypal,omitempty"`
Chime *PayoutCashAppExtra `json:"chime,omitempty"`
UsdtTrc20 *PayoutUsdtExtra `json:"usdtTrc20,omitempty"`
UsdtErc20 *PayoutUsdtExtra `json:"usdtErc20,omitempty"`
UsdtBep20 *PayoutUsdtExtra `json:"usdtBep20,omitempty"`
P2P *PayoutRubBankExtra `json:"p2p,omitempty"`
Sbp *PayoutRubBankExtra `json:"sbp,omitempty"`
BdBkash *PayoutAccountContactExtra `json:"bdBkash,omitempty"`
BdNagad *PayoutAccountContactExtra `json:"bdNagad,omitempty"`
IdBankTransfer *PayoutBankAccountContactExtra `json:"idBankTransfer,omitempty"`
IdDana *PayoutBankAccountContactExtra `json:"idDana,omitempty"`
IdOvo *PayoutBankAccountContactExtra `json:"idOvo,omitempty"`
IdGopay *PayoutBankAccountContactExtra `json:"idGopay,omitempty"`
IdLinkaja *PayoutBankAccountContactExtra `json:"idLinkaja,omitempty"`
IdShopeepay *PayoutBankAccountContactExtra `json:"idShopeepay,omitempty"`
PhGcash *PayoutBankAccountContactExtra `json:"phGcash,omitempty"`
PhMaya *PayoutBankAccountContactExtra `json:"phMaya,omitempty"`
PhDfWallet *PayoutBankAccountContactExtra `json:"phDfWallet,omitempty"`
PhDfBank *PayoutBankAccountContactExtra `json:"phDfBank,omitempty"`
EWallet *PayoutEWalletExtra `json:"eWallet,omitempty"`
PkJazzcash *PayoutPkDfExtra `json:"pkJazzcash,omitempty"`
PkEasypaisa *PayoutPkDfExtra `json:"pkEasypaisa,omitempty"`
PkBank *PayoutPkDfExtra `json:"pkBank,omitempty"`
ThBankTransfer *PayoutBankAccountContactExtra `json:"thBankTransfer,omitempty"`
InIfsc *PayoutInIfscExtra `json:"inIfsc,omitempty"`
InUpi *PayoutInUpiExtra `json:"inUpi,omitempty"`
// contains filtered or unexported fields
}
PayoutMethod holds strongly-typed fields for every current payout branch; like PaymentMethod, use SetExtra for an unlisted method.
func (PayoutMethod) MarshalJSON ¶
func (m PayoutMethod) MarshalJSON() ([]byte, error)
type PayoutOrder ¶
type PayoutOrder struct {
RefundNo string `json:"refundNo,omitempty"`
RefundAmount string `json:"refundAmount,omitempty"`
RefundTime int64 `json:"refundTime,omitempty"`
OrderNo string `json:"orderNo"`
MerchantOrderNo string `json:"merchantOrderNo"`
Status string `json:"status"`
Currency string `json:"currency"`
Amount string `json:"amount"`
Country string `json:"country,omitempty"`
PayoutMethod string `json:"payoutMethod"`
Action OrderAction `json:"action"`
Attach string `json:"attach,omitempty"`
Failure *WebhookFailure `json:"failure,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type PayoutPaparaExtra ¶
type PayoutPixExtra ¶
type PayoutPixExtra struct {
KeyType string `json:"keyType,omitempty"`
Key string `json:"key,omitempty"`
Document string `json:"document,omitempty"`
AccountName string `json:"accountName,omitempty"`
CpfVerify *bool `json:"cpfVerify,omitempty"`
AccountType string `json:"accountType,omitempty"`
BankBranch string `json:"bankBranch,omitempty"`
}
type PayoutPkDfExtra ¶
type PayoutReceipt ¶
type PayoutReceipt struct {
OrderNo string `json:"orderNo"`
Amount string `json:"amount"`
Currency string `json:"currency"`
Timestamp int64 `json:"timestamp"`
ChannelTradeNo string `json:"channelTradeNo,omitempty"`
SourceAccount *ReceiptAccount `json:"sourceAccount,omitempty"`
DestinationAccount *ReceiptAccount `json:"destinationAccount,omitempty"`
Url string `json:"url,omitempty"`
}
type PayoutRubBankExtra ¶
type PayoutTransfiyaExtra ¶
type PayoutTransfiyaExtra struct {
DocumentType string `json:"documentType,omitempty"`
DocumentNumber string `json:"documentNumber,omitempty"`
CustomerName string `json:"customerName,omitempty"`
CustomerPhone string `json:"customerPhone,omitempty"`
CustomerEmail string `json:"customerEmail,omitempty"`
}
type PayoutUsdtExtra ¶
type PayoutWebhook ¶
type PayoutWebhook struct {
RefundNo string `json:"refundNo,omitempty"`
RefundAmount string `json:"refundAmount,omitempty"`
RefundTime int64 `json:"refundTime,omitempty"`
EventID string `json:"eventId"`
OrderType string `json:"orderType"`
OrderNo string `json:"orderNo"`
MerchantOrderNo string `json:"merchantOrderNo"`
Status string `json:"status"`
Currency string `json:"currency"`
Amount string `json:"amount"`
ChannelTradeNo string `json:"channelTradeNo,omitempty"`
Attach string `json:"attach,omitempty"`
Failure *WebhookFailure `json:"failure,omitempty"`
}
type ReceiptAccount ¶
type ReceiptAccount struct {
Bank *ReceiptBank `json:"bank,omitempty"`
Name string `json:"name,omitempty"`
TaxId string `json:"taxId,omitempty"`
TaxType string `json:"taxType,omitempty"`
Key string `json:"key,omitempty"`
}
type ReceiptBank ¶
type RequestOption ¶
type RequestOption func(*requestOptions)
func WithIdempotencyKey ¶
func WithIdempotencyKey(key string) RequestOption
type ResponseError ¶
ResponseError is returned when the server returned a non-envelope body (an HTML error page or plain-text 502 from the gateway or CDN); distinct from *APIError.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type SubmitTradeNoResult ¶
type SubmitTradeNoResult struct {
Status int64 `json:"status"`
// OrderStatus is the checkout-facing order status (CREATED / PENDING / …).
OrderStatus string `json:"orderStatus,omitempty"`
Message string `json:"message,omitempty"`
}
SubmitTradeNoResult is the answer to SubmitPaymentTradeNo.
A nil error does not mean the platform accepted the call: the endpoint answers HTTP 200 with envelope code 200 even when it refuses, and the outcome is carried by Status: 1 accepted, 0 refused with Message giving the reason, so a nil error alone does not mean the submission was accepted.
func (*SubmitTradeNoResult) Ok ¶
func (r *SubmitTradeNoResult) Ok() bool
Ok reports whether the platform accepted the submission.
type WebhookFailure ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
merchantauth
Package merchantauth implements the merchant API request signing, body sealing and webhook verification primitives shared by the platform and the SDKs.
|
Package merchantauth implements the merchant API request signing, body sealing and webhook verification primitives shared by the platform and the SDKs. |