Documentation
¶
Index ¶
- Constants
- func NormalizeXenditCustomerID(id string) string
- type BasketQrCode
- type Client
- func (c *Client) ExecuteRequest(req *http.Request, v interface{}) (httpStatus int, err error)
- func (c *Client) NewDisbBatchRequest(key string, method string, fullPath string, body io.Reader) (*http.Request, error)
- func (c *Client) NewRequest(method string, fullPath string, body io.Reader) (*http.Request, error)
- func (c *Client) NewRequestWithoutAPIVersion(method string, fullPath string, body io.Reader) (*http.Request, error)
- type DisbursementGateway
- type DisbursementItem
- type EnvironmentType
- func (e EnvironmentType) CancelPaymentSessionURL(paymentSessionID string) string
- func (e EnvironmentType) CancelPaymentTokenURL(paymentTokenID string) string
- func (e EnvironmentType) CreateCallbackVirtualAccountURL() string
- func (e EnvironmentType) CreateCreditCardChargeURL() string
- func (e EnvironmentType) CreateCustomerURL() string
- func (e EnvironmentType) CreateDisbursementURL() string
- func (e EnvironmentType) CreateInvoiceURL() string
- func (e EnvironmentType) CreatePaymentRequestURL() string
- func (e EnvironmentType) CreatePaymentSessionURL() string
- func (e EnvironmentType) GetCustomersByReferenceIDURL(referenceID string) string
- func (e EnvironmentType) GetPaymentRequestURL(paymentRequestID string) string
- func (e EnvironmentType) GetPaymentSessionURL(paymentSessionID string) string
- func (e EnvironmentType) GetPaymentTokenURL(paymentTokenID string) string
- func (e EnvironmentType) GetVirtualAccountBanksURL() string
- func (e EnvironmentType) String() string
- type InvoiceAvailableBank
- type InvoiceGateway
- func (gateway *InvoiceGateway) CancelPaymentSession(paymentSessionID string) (*XenditPaymentSessionResp, error)
- func (gateway *InvoiceGateway) CancelPaymentToken(paymentTokenID string) (*XenditPaymentTokenResp, error)
- func (gateway *InvoiceGateway) CreateCreditCardCharge(req *XenditCreateCreditCardChargeReq) (*XenditCreateCreditCardChargeResp, error)
- func (gateway *InvoiceGateway) CreateCustomer(req *XenditPaymentSessionCustomer) (*XenditCustomerResp, error)
- func (gateway *InvoiceGateway) CreateFixedVa(req *XenditCreateFixedVaReq) (*XenditCreateFixedVaResp, error)
- func (gateway *InvoiceGateway) CreateInvoice(req *XenditCreateInvoiceReq) (*XenditCreateInvoiceResp, error)
- func (gateway *InvoiceGateway) CreatePaymentMethod(req *XenditCreatePaymentMethodReq) (*XenditPaymentMethodResp, error)
- func (gateway *InvoiceGateway) CreatePaymentRequest(req *XenditCreatePaymentRequestReq) (*XenditPaymentRequestResp, error)
- func (gateway *InvoiceGateway) CreatePaymentSession(req *XenditCreatePaymentSessionReq) (*XenditPaymentSessionResp, error)
- func (gateway *InvoiceGateway) CreatePayout(req *XenditCreatePayoutReq) (*XenditCreatePayoutResp, error)
- func (gateway *InvoiceGateway) ExpireInvoice(invoiceID string) (*XenditCreateInvoiceResp, error)
- func (gateway *InvoiceGateway) GetCustomerByReferenceID(referenceID string) (*XenditCustomerResp, error)
- func (gateway *InvoiceGateway) GetFixedVa(id string) (*XenditCreateFixedVaResp, error)
- func (gateway *InvoiceGateway) GetPaymentRequest(paymentRequestID string) (*XenditPaymentRequestResp, error)
- func (gateway *InvoiceGateway) GetPaymentSession(paymentSessionID string) (*XenditPaymentSessionResp, error)
- func (gateway *InvoiceGateway) GetPaymentToken(paymentTokenID string) (*XenditPaymentTokenResp, error)
- func (gateway *InvoiceGateway) GetPayout(payoutID string) (*XenditCreatePayoutResp, error)
- func (gateway *InvoiceGateway) UpdateFixedVa(id string, req *XenditUpdateFixedVaReq) (*XenditCreateFixedVaResp, error)
- func (gateway *InvoiceGateway) VoidPayout(payoutID string) (*XenditCreatePayoutResp, error)
- type PaymentDetails
- type PayoutGateway
- type QrcodeGateway
- type XenditCreateBatchReq
- type XenditCreateBatchResp
- type XenditCreateCreditCardChargeReq
- type XenditCreateCreditCardChargeResp
- type XenditCreateFixedVaReq
- type XenditCreateFixedVaResp
- type XenditCreateInvoiceReq
- type XenditCreateInvoiceResp
- type XenditCreatePaymentMethodReq
- type XenditCreatePaymentRequestReq
- type XenditCreatePaymentSessionReq
- type XenditCreatePayoutReq
- type XenditCreatePayoutResp
- type XenditCreditCardCallback
- type XenditCreteQrcodeReq
- type XenditCustomerListResp
- type XenditCustomerResp
- type XenditErrorResponse
- type XenditFixedVaCreatedNotification
- type XenditNotification
- type XenditNotificationResp
- type XenditPaymentCaptureCallback
- type XenditPaymentMethodAllowedBankAccount
- type XenditPaymentMethodChannelProperties
- type XenditPaymentMethodResp
- type XenditPaymentMethodVerificationData
- type XenditPaymentRequestAction
- type XenditPaymentRequestCardDetails
- type XenditPaymentRequestChannelProperties
- type XenditPaymentRequestResp
- type XenditPaymentResp
- type XenditPaymentSessionCardsChannelProperties
- type XenditPaymentSessionCardsSessionJS
- type XenditPaymentSessionChannelProperties
- type XenditPaymentSessionCustomer
- type XenditPaymentSessionIndividualDetail
- type XenditPaymentSessionResp
- type XenditPaymentTokenCallback
- type XenditPaymentTokenCardDetails
- type XenditPaymentTokenChannelProperties
- type XenditPaymentTokenResp
- type XenditQrCodeCallback
- type XenditQrCodeResp
- type XenditUpdateFixedVaReq
- type XenditVerifyPaymentResponse
Constants ¶
const ( // PaymentsAPIVersion is the api-version header value for Payments API v3. PaymentsAPIVersion = "2024-11-11" SessionTypePay = "PAY" SessionTypeSave = "SAVE" SessionModeCardsSessionJS = "CARDS_SESSION_JS" SessionModePaymentLink = "PAYMENT_LINK" SessionModeComponents = "COMPONENTS" PaymentRequestTypePay = "PAY" PaymentRequestTypePayAndSave = "PAY_AND_SAVE" CaptureMethodAutomatic = "AUTOMATIC" CaptureMethodManual = "MANUAL" CardOnFileCustomerUnscheduled = "CUSTOMER_UNSCHEDULED" CardOnFileRecurring = "RECURRING" CardOnFileMerchantUnscheduled = "MERCHANT_UNSCHEDULED" TransactionSequenceSubsequent = "SUBSEQUENT" TransactionSequenceInitial = "INITIAL" AllowSavePaymentMethodForced = "FORCED" AllowSavePaymentMethodOptional = "OPTIONAL" AllowSavePaymentMethodDisabled = "DISABLED" WebhookEventPaymentCapture = "payment.capture" WebhookEventPaymentTokenActivated = "payment_token.activated" WebhookEventPaymentSessionCompleted = "payment_session.completed" )
Payments API v3 constants. Docs: https://docs.xendit.co/docs/payments-via-api-overview
Variables ¶
This section is empty.
Functions ¶
func NormalizeXenditCustomerID ¶ added in v1.0.8
NormalizeXenditCustomerID ensures Payments API v3 customer_id format (cust-{uuid}, min 41 chars). Customer API may return bare UUID in the "id" field without the cust- prefix.
Types ¶
type BasketQrCode ¶ added in v1.0.5
type BasketQrCode struct {
ReferenceId string `json:"reference_id"`
Name string `json:"name"`
Category string `json:"category"`
Currency string `json:"currency"`
Price float64 `json:"price"`
Quantity float64 `json:"quantity"`
Type string `json:"type"`
Url string `json:"url"`
Description string `json:"description"`
SubCategory string `json:"sub-category"`
}
type Client ¶
type Client struct {
APIEnvType EnvironmentType
SecretAPIKey string
ApiVersion string
PaymentsAPIVersion string
InvoiceDurationInSeconds int
LogLevel int
}
Client struct
func NewClient ¶
func NewClient() Client
NewClient : this function will always be called when the library is in use
func (*Client) ExecuteRequest ¶
ExecuteRequest : execute request
func (*Client) NewDisbBatchRequest ¶ added in v1.0.4
func (c *Client) NewDisbBatchRequest(key string, method string, fullPath string, body io.Reader) (*http.Request, error)
NewRequest for batch disbursement : send new request
func (*Client) NewRequest ¶
NewRequest : send new request
type DisbursementGateway ¶ added in v1.0.4
type DisbursementGateway struct {
Client Client
}
PayoutGateway struct
func (*DisbursementGateway) CreateBatchDisbursement ¶ added in v1.0.4
func (gateway *DisbursementGateway) CreateBatchDisbursement(key string, req *XenditCreateBatchReq) (*XenditCreateBatchResp, error)
CreatePayout call create Payout API
type DisbursementItem ¶ added in v1.0.4
type EnvironmentType ¶
type EnvironmentType int8
EnvironmentType value
const ( // Sandbox : represent sandbox environment Sandbox EnvironmentType // Production : represent production environment Production )
func (EnvironmentType) CancelPaymentSessionURL ¶ added in v1.0.8
func (e EnvironmentType) CancelPaymentSessionURL(paymentSessionID string) string
CancelPaymentSessionURL cancels a Payments API v3 session.
func (EnvironmentType) CancelPaymentTokenURL ¶ added in v1.0.8
func (e EnvironmentType) CancelPaymentTokenURL(paymentTokenID string) string
CancelPaymentTokenURL deactivates a Payments API v3 payment token.
func (EnvironmentType) CreateCallbackVirtualAccountURL ¶
func (e EnvironmentType) CreateCallbackVirtualAccountURL() string
CreateCallbackVirtualAccountURL : is used to create FixedVA
func (EnvironmentType) CreateCreditCardChargeURL ¶ added in v1.0.8
func (e EnvironmentType) CreateCreditCardChargeURL() string
CreateCreditCardChargeURL creates a credit card charge (legacy v2).
func (EnvironmentType) CreateCustomerURL ¶ added in v1.0.8
func (e EnvironmentType) CreateCustomerURL() string
CreateCustomerURL creates an end-customer resource.
func (EnvironmentType) CreateDisbursementURL ¶
func (e EnvironmentType) CreateDisbursementURL() string
CreateDisbursementURL : Create a disbursement
func (EnvironmentType) CreateInvoiceURL ¶
func (e EnvironmentType) CreateInvoiceURL() string
CreateInvoiceURL : Create invoice for accepting payment
func (EnvironmentType) CreatePaymentRequestURL ¶ added in v1.0.8
func (e EnvironmentType) CreatePaymentRequestURL() string
CreatePaymentRequestURL creates a Payments API v3 payment request.
func (EnvironmentType) CreatePaymentSessionURL ¶ added in v1.0.8
func (e EnvironmentType) CreatePaymentSessionURL() string
CreatePaymentSessionURL creates a Payments API v3 session.
func (EnvironmentType) GetCustomersByReferenceIDURL ¶ added in v1.0.8
func (e EnvironmentType) GetCustomersByReferenceIDURL(referenceID string) string
GetCustomersByReferenceIDURL looks up an existing Xendit customer by merchant reference_id.
func (EnvironmentType) GetPaymentRequestURL ¶ added in v1.0.8
func (e EnvironmentType) GetPaymentRequestURL(paymentRequestID string) string
GetPaymentRequestURL retrieves a Payments API v3 payment request.
func (EnvironmentType) GetPaymentSessionURL ¶ added in v1.0.8
func (e EnvironmentType) GetPaymentSessionURL(paymentSessionID string) string
GetPaymentSessionURL retrieves a Payments API v3 session.
func (EnvironmentType) GetPaymentTokenURL ¶ added in v1.0.8
func (e EnvironmentType) GetPaymentTokenURL(paymentTokenID string) string
GetPaymentTokenURL retrieves a Payments API v3 payment token.
func (EnvironmentType) GetVirtualAccountBanksURL ¶
func (e EnvironmentType) GetVirtualAccountBanksURL() string
GetVirtualAccountBanksURL : Get available virtual account banks
type InvoiceAvailableBank ¶
type InvoiceAvailableBank struct {
BankCode string `json:"bank_code"`
CollectionType string `json:"collection_type"`
BankAccountNumber string `json:"bank_account_number"`
TransferAmount float64 `json:"transfer_amount"`
BankBranch string `json:"bank_branch"`
AccountHolderName string `json:"account_holder_name"`
IdentityAmount float64 `json:"identity_amount"`
}
InvoiceAvailableBank is options of invoice available bank
type InvoiceGateway ¶
type InvoiceGateway struct {
Client Client
}
InvoiceGateway struct
func (*InvoiceGateway) CancelPaymentSession ¶ added in v1.0.8
func (gateway *InvoiceGateway) CancelPaymentSession(paymentSessionID string) (*XenditPaymentSessionResp, error)
CancelPaymentSession cancels an ACTIVE session. Docs: https://docs.xendit.co/apidocs/cancel-session
func (*InvoiceGateway) CancelPaymentToken ¶ added in v1.0.8
func (gateway *InvoiceGateway) CancelPaymentToken(paymentTokenID string) (*XenditPaymentTokenResp, error)
CancelPaymentToken deactivates a saved payment token. Docs: https://docs.xendit.co/apidocs/cancel-payment-token
func (*InvoiceGateway) CreateCreditCardCharge ¶ added in v1.0.8
func (gateway *InvoiceGateway) CreateCreditCardCharge(req *XenditCreateCreditCardChargeReq) (*XenditCreateCreditCardChargeResp, error)
CreateCreditCardCharge calls Xendit credit card charge API.
func (*InvoiceGateway) CreateCustomer ¶ added in v1.0.8
func (gateway *InvoiceGateway) CreateCustomer(req *XenditPaymentSessionCustomer) (*XenditCustomerResp, error)
CreateCustomer creates an end-customer resource before payment session. Docs: https://docs.xendit.co/apidocs/create-customer-request
func (*InvoiceGateway) CreateFixedVa ¶
func (gateway *InvoiceGateway) CreateFixedVa(req *XenditCreateFixedVaReq) (*XenditCreateFixedVaResp, error)
CreateFixedVa call create fixed va API
func (*InvoiceGateway) CreateInvoice ¶
func (gateway *InvoiceGateway) CreateInvoice(req *XenditCreateInvoiceReq) (*XenditCreateInvoiceResp, error)
CreateInvoice call create invoice API
func (*InvoiceGateway) CreatePaymentMethod ¶ added in v1.0.7
func (gateway *InvoiceGateway) CreatePaymentMethod(req *XenditCreatePaymentMethodReq) (*XenditPaymentMethodResp, error)
func (*InvoiceGateway) CreatePaymentRequest ¶ added in v1.0.8
func (gateway *InvoiceGateway) CreatePaymentRequest(req *XenditCreatePaymentRequestReq) (*XenditPaymentRequestResp, error)
CreatePaymentRequest creates a payment request (one-time, pay-and-save, pay with token). Docs: https://docs.xendit.co/apidocs/create-payment-request
func (*InvoiceGateway) CreatePaymentSession ¶ added in v1.0.8
func (gateway *InvoiceGateway) CreatePaymentSession(req *XenditCreatePaymentSessionReq) (*XenditPaymentSessionResp, error)
CreatePaymentSession creates a Payments API v3 session (PAY, SAVE, one-click CVN). Docs: https://docs.xendit.co/apidocs/create-session
func (*InvoiceGateway) CreatePayout ¶ added in v1.0.3
func (gateway *InvoiceGateway) CreatePayout(req *XenditCreatePayoutReq) (*XenditCreatePayoutResp, error)
CreatePayout call create Payout API
func (*InvoiceGateway) ExpireInvoice ¶ added in v1.0.7
func (gateway *InvoiceGateway) ExpireInvoice(invoiceID string) (*XenditCreateInvoiceResp, error)
ExpireInvoice expires an invoice by invoice ID Endpoint: POST https://api.xendit.co/invoices/{invoice_id}/expire! According to Xendit docs, the endpoint is /invoices/{invoice_id}/expire! (with !, without /v2/) We'll try the documented endpoint first, then fallback to v2 if needed
func (*InvoiceGateway) GetCustomerByReferenceID ¶ added in v1.0.8
func (gateway *InvoiceGateway) GetCustomerByReferenceID(referenceID string) (*XenditCustomerResp, error)
GetCustomerByReferenceID returns an existing customer or nil if not found. Docs: https://docs.xendit.co/apidocs/get-customers-list
func (*InvoiceGateway) GetFixedVa ¶ added in v1.0.7
func (gateway *InvoiceGateway) GetFixedVa(id string) (*XenditCreateFixedVaResp, error)
func (*InvoiceGateway) GetPaymentRequest ¶ added in v1.0.8
func (gateway *InvoiceGateway) GetPaymentRequest(paymentRequestID string) (*XenditPaymentRequestResp, error)
GetPaymentRequest retrieves payment request status.
func (*InvoiceGateway) GetPaymentSession ¶ added in v1.0.8
func (gateway *InvoiceGateway) GetPaymentSession(paymentSessionID string) (*XenditPaymentSessionResp, error)
GetPaymentSession retrieves session status by payment_session_id.
func (*InvoiceGateway) GetPaymentToken ¶ added in v1.0.8
func (gateway *InvoiceGateway) GetPaymentToken(paymentTokenID string) (*XenditPaymentTokenResp, error)
GetPaymentToken retrieves saved payment token details (masked card).
func (*InvoiceGateway) GetPayout ¶ added in v1.0.3
func (gateway *InvoiceGateway) GetPayout(payoutID string) (*XenditCreatePayoutResp, error)
GetPayout call create Payout API
func (*InvoiceGateway) UpdateFixedVa ¶ added in v1.0.7
func (gateway *InvoiceGateway) UpdateFixedVa(id string, req *XenditUpdateFixedVaReq) (*XenditCreateFixedVaResp, error)
func (*InvoiceGateway) VoidPayout ¶ added in v1.0.3
func (gateway *InvoiceGateway) VoidPayout(payoutID string) (*XenditCreatePayoutResp, error)
VoidPayout call create Payout API
type PaymentDetails ¶ added in v1.0.5
type PayoutGateway ¶ added in v1.0.3
type PayoutGateway struct {
Client Client
}
PayoutGateway struct
type QrcodeGateway ¶ added in v1.0.5
type QrcodeGateway struct {
Client Client
}
InvoiceGateway struct
func (*QrcodeGateway) CreateQrCode ¶ added in v1.0.5
func (gateway *QrcodeGateway) CreateQrCode(req *XenditCreteQrcodeReq) (*XenditQrCodeResp, error)
CreateInvoice call create invoice API
func (*QrcodeGateway) PayQrCode ¶ added in v1.0.5
func (gateway *QrcodeGateway) PayQrCode(qrId string) (*XenditQrCodeResp, error)
type XenditCreateBatchReq ¶ added in v1.0.4
type XenditCreateBatchReq struct {
HeaderID string `json:"reference"`
Disbursements []DisbursementItem `json:"disbursements"`
}
type XenditCreateBatchResp ¶ added in v1.0.4
type XenditCreateCreditCardChargeReq ¶ added in v1.0.8
type XenditCreateCreditCardChargeReq struct {
TokenID string `json:"token_id"`
ExternalID string `json:"external_id"`
Amount float64 `json:"amount"`
AuthenticationID string `json:"authentication_id,omitempty"`
Capture bool `json:"capture"`
}
XenditCreateCreditCardChargeReq is JSON request for credit card charge API.
type XenditCreateCreditCardChargeResp ¶ added in v1.0.8
type XenditCreateCreditCardChargeResp struct {
ID string `json:"id"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
AuthorizedAmount float64 `json:"authorized_amount"`
CapturedAmount float64 `json:"captured_amount"`
PayerAuthenticationURL string `json:"payer_authentication_url"`
FailureReason string `json:"failure_reason"`
Created string `json:"created"`
Updated string `json:"updated"`
XenditErrorResponse
}
XenditCreateCreditCardChargeResp is JSON response from credit card charge API.
type XenditCreateFixedVaReq ¶
type XenditCreateFixedVaReq struct {
ExternalID string `json:"external_id"`
BankCode string `json:"bank_code"`
Name string `json:"name"`
VirtualAccountNumber string `json:"virtual_account_number,omitempty"`
IsClosed *bool `json:"is_closed,omitempty"`
ExpectedAmount float64 `json:"expected_amount,omitempty"`
IsSingleUse *bool `json:"is_single_use,omitempty"`
}
XenditCreateFixedVaReq is JSON request to be sent to Xendit to create Callback Fixed VA
type XenditCreateFixedVaResp ¶
type XenditCreateFixedVaResp struct {
ID string `json:"id"`
OwnerID string `json:"owner_id"`
ExternalID string `json:"external_id"`
MerchantCode string `json:"merchant_code"`
AccountNumber string `json:"account_number"`
BankCode string `json:"bank_code"`
Name string `json:"name"`
IsClosed bool `json:"is_closed"`
ExpirationDate string `json:"expiration_date"`
IsSingleUse bool `json:"is_single_use"`
Status string `json:"status"`
Currency string `json:"currency"`
CreatedDateTime string `json:"created"`
UpdatedDateTime string `json:"updated"`
XenditErrorResponse
}
XenditCreateFixedVaResp is JSON response returned by Xendit when cal Create Callback Fixed VA
type XenditCreateInvoiceReq ¶
type XenditCreateInvoiceReq struct {
ExternalID string `json:"external_id"`
Amount float64 `json:"amount"`
PayerEmail string `json:"payer_email"`
Description string `json:"description"`
ShouldSendEmail bool `json:"should_send_email"`
CallbackVirtualAccountID string `json:"callback_virtual_account_id,omitempty"`
InvoiceDuration int `json:"invoice_duration"`
PaymentMethod []string `json:"payment_methods"`
}
XenditCreateInvoiceReq is JSON request to be sent to Xendit when an Invoice Created
type XenditCreateInvoiceResp ¶
type XenditCreateInvoiceResp struct {
InvoiceID string `json:"id"`
UserID string `json:"user_id"`
ExternalID string `json:"external_id"`
IsHigh bool `json:"is_high"`
Status string `json:"status"`
MerchantName string `json:"merchant_name"`
Amount float64 `json:"amount"`
PayerEmail string `json:"payer_email"`
Description string `json:"description"`
ExpiryDate string `json:"expiry_date"`
InvoiceURL string `json:"invoice_url"`
ShouldExcludeCreditCard bool `json:"should_exclude_credit_card" `
ShouldSendEmail bool `json:"should_send_email"`
CreatedDateTime string `json:"created"`
UpdatedDateTime string `json:"updated"`
AvailableBanks []InvoiceAvailableBank `json:"available_banks"`
XenditErrorResponse
}
XenditCreateInvoiceResp is JSON response returned by Xendit when an Invoice Created
type XenditCreatePaymentMethodReq ¶ added in v1.0.7
type XenditCreatePaymentMethodReq struct {
ReferenceID string `json:"reference_id"`
Type string `json:"type"`
Reusability string `json:"reusability"`
Country string `json:"country"`
Currency string `json:"currency"`
ChannelCode string `json:"channel_code"`
ChannelProperties XenditPaymentMethodChannelProperties `json:"channel_properties"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CustomerID string `json:"customer_id,omitempty"`
Description string `json:"description,omitempty"`
}
type XenditCreatePaymentRequestReq ¶ added in v1.0.8
type XenditCreatePaymentRequestReq struct {
ReferenceID string `json:"reference_id"`
PaymentTokenID string `json:"payment_token_id,omitempty"`
Type string `json:"type"`
Country string `json:"country"`
Currency string `json:"currency"`
RequestAmount float64 `json:"request_amount"`
CaptureMethod string `json:"capture_method,omitempty"`
ChannelProperties *XenditPaymentRequestChannelProperties `json:"channel_properties,omitempty"`
Description string `json:"description,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
XenditCreatePaymentRequestReq is JSON request for POST /v3/payment_requests. Docs: https://docs.xendit.co/docs/pay-with-tokens
type XenditCreatePaymentSessionReq ¶ added in v1.0.8
type XenditCreatePaymentSessionReq struct {
ReferenceID string `json:"reference_id"`
SessionType string `json:"session_type"`
Mode string `json:"mode"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Country string `json:"country"`
CustomerID string `json:"customer_id,omitempty"`
Customer *XenditPaymentSessionCustomer `json:"customer,omitempty"`
PaymentTokenID string `json:"payment_token_id,omitempty"`
ChannelProperties *XenditPaymentSessionChannelProperties `json:"channel_properties,omitempty"`
CardsSessionJS *XenditPaymentSessionCardsSessionJS `json:"cards_session_js,omitempty"`
AllowSavePaymentMethod string `json:"allow_save_payment_method,omitempty"`
CaptureMethod string `json:"capture_method,omitempty"`
SuccessReturnURL string `json:"success_return_url,omitempty"`
CancelReturnURL string `json:"cancel_return_url,omitempty"`
Description string `json:"description,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
XenditCreatePaymentSessionReq is JSON request for POST /sessions. Docs: https://docs.xendit.co/apidocs/create-session
type XenditCreatePayoutReq ¶ added in v1.0.3
type XenditCreatePayoutReq struct {
ExternalID string `json:"external_id"`
Amount float64 `json:"amount"`
}
XenditCreatePayoutReq is JSON request for Payout feature
type XenditCreatePayoutResp ¶ added in v1.0.3
type XenditCreatePayoutResp struct {
ID string `json:"id"`
ExternalID string `json:"external_id"`
Amount float64 `json:"amount"`
PassCode string `json:"passcode"`
MerchantName string `json:"merchant_name"`
Status string `json:"status"`
ExpiredTimestamp string `json:"expiration_timestamp"`
CreatedTimestamp string `json:"created"`
PayoutURL string `json:"payout_url,omitempty"`
XenditErrorResponse
}
XenditCreatePayoutResp response from payout
type XenditCreditCardCallback ¶ added in v1.0.8
type XenditCreditCardCallback struct {
Event string `json:"event"`
ID string `json:"id"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
Data struct {
ID string `json:"id"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
} `json:"data"`
}
XenditCreditCardCallback is webhook payload for credit card charge events.
func (XenditCreditCardCallback) ChargeID ¶ added in v1.0.8
func (p XenditCreditCardCallback) ChargeID() string
ChargeID returns the Xendit charge ID from callback payload.
func (XenditCreditCardCallback) ChargeStatus ¶ added in v1.0.8
func (p XenditCreditCardCallback) ChargeStatus() string
ChargeStatus returns normalized charge status from callback payload.
func (XenditCreditCardCallback) OrderNo ¶ added in v1.0.8
func (p XenditCreditCardCallback) OrderNo() string
OrderNo returns the order reference (external_id) from callback payload.
type XenditCreteQrcodeReq ¶ added in v1.0.5
type XenditCustomerListResp ¶ added in v1.0.8
type XenditCustomerListResp struct {
Data []XenditCustomerResp `json:"data"`
HasMore bool `json:"has_more"`
}
XenditCustomerListResp is the list wrapper for GET /customers?reference_id=...
type XenditCustomerResp ¶ added in v1.0.8
type XenditCustomerResp struct {
ID string `json:"id"`
ReferenceID string `json:"reference_id"`
Email string `json:"email"`
XenditErrorResponse
}
XenditCustomerResp is a customer object from GET/POST /customers.
type XenditErrorResponse ¶
type XenditErrorResponse struct {
// For Errors
ErrorCode string `json:"error_code"`
ErrorMessage string `json:"message"`
ErrorStatus bool `json:"-"`
}
XenditErrorResponse xendit error response
func (XenditErrorResponse) Error ¶
func (e XenditErrorResponse) Error() string
type XenditFixedVaCreatedNotification ¶
type XenditFixedVaCreatedNotification struct {
VaID string `json:"id"`
OwnerID string `json:"owner_id"`
ExternalID string `json:"extenral_id"`
MerchantCode string `json:"merchant_code"`
AccountNumber string `json:"account_number"`
BankCode string `json:"bank_code"`
Name string `json:"name"`
IsClosed bool `json:"is_closed"`
ExpirationDate string `json:"expiration_date"`
IsSingleUse bool `json:"is_single_use"`
Status string `json:"active"`
CreatedDateTime string `json:"created_datetime"`
UpdatedDateTime string `json:"updated_datetime"`
}
XenditFixedVaCreatedNotification is standard callback when FixedVaCreated
type XenditNotification ¶
type XenditNotification struct {
TransactionID string `json:"id"`
ExternalID string `json:"external_id"`
UserID string `json:"user_id"`
IsHigh bool `json:"is_high"`
PaymentMethod string `json:"payment_method"`
Status string `json:"status"`
MerchantName string `json:"merchant_name"`
Amount string `json:"amount"`
PaidAmount string `json:"paid_amount"`
BankCode string `json:"bank_code"`
PayerEmail string `json:"payer_email"`
Description string `json:"description"`
AdjustedReceivedAmount string `json:"adjusted_received_amount"`
FeesPaidAmount string `json:"feeds_paid_amount"`
CreatedDateTime string `json:"created_datetime"`
UpdatedDateTime string `json:"updated_datetime"`
}
XenditNotification to store notification payment
type XenditNotificationResp ¶
type XenditNotificationResp struct {
Status string `json:"status"`
Message string `json:"message"`
}
XenditNotificationResp is standard response for Xendit
type XenditPaymentCaptureCallback ¶ added in v1.0.8
type XenditPaymentCaptureCallback struct {
Event string `json:"event"`
BusinessID string `json:"business_id"`
Created string `json:"created"`
Data struct {
PaymentID string `json:"payment_id"`
PaymentRequestID string `json:"payment_request_id"`
ReferenceID string `json:"reference_id"`
Status string `json:"status"`
Currency string `json:"currency"`
RequestAmount float64 `json:"request_amount"`
CaptureAmount float64 `json:"capture_amount"`
PaymentTokenID string `json:"payment_token_id"`
} `json:"data"`
}
XenditPaymentCaptureCallback is webhook payload for payment.capture (Payments API v3).
func (XenditPaymentCaptureCallback) IsPaymentSucceeded ¶ added in v1.0.8
func (p XenditPaymentCaptureCallback) IsPaymentSucceeded() bool
IsPaymentSucceeded reports whether capture webhook indicates success.
func (XenditPaymentCaptureCallback) OrderNo ¶ added in v1.0.8
func (p XenditPaymentCaptureCallback) OrderNo() string
OrderNo returns merchant reference_id from webhook payload.
func (XenditPaymentCaptureCallback) PaymentRequestID ¶ added in v1.0.8
func (p XenditPaymentCaptureCallback) PaymentRequestID() string
PaymentRequestID returns payment_request_id from webhook payload.
func (XenditPaymentCaptureCallback) PaymentStatus ¶ added in v1.0.8
func (p XenditPaymentCaptureCallback) PaymentStatus() string
PaymentStatus returns normalized payment status from webhook payload.
type XenditPaymentMethodAllowedBankAccount ¶ added in v1.0.7
type XenditPaymentMethodChannelProperties ¶ added in v1.0.7
type XenditPaymentMethodChannelProperties struct {
ExpiresAt string `json:"expires_at,omitempty"`
DisplayName string `json:"display_name,omitempty"`
VerificationData *XenditPaymentMethodVerificationData `json:"verification_data,omitempty"`
VirtualAccountNumber string `json:"virtual_account_number,omitempty"`
}
type XenditPaymentMethodResp ¶ added in v1.0.7
type XenditPaymentMethodResp struct {
ID string `json:"id"`
ReferenceID string `json:"reference_id"`
Type string `json:"type"`
Reusability string `json:"reusability"`
Status string `json:"status"`
Country string `json:"country"`
Currency string `json:"currency"`
ChannelCode string `json:"channel_code"`
ChannelProperties XenditPaymentMethodChannelProperties `json:"channel_properties"`
CustomerID string `json:"customer_id"`
Description string `json:"description"`
Created string `json:"created"`
Updated string `json:"updated"`
XenditErrorResponse
}
type XenditPaymentMethodVerificationData ¶ added in v1.0.7
type XenditPaymentMethodVerificationData struct {
CustomerName string `json:"customer_name"`
AcceptedNameVariations []string `json:"accepted_name_variations,omitempty"`
AllowedBankAccounts []XenditPaymentMethodAllowedBankAccount `json:"allowed_bank_accounts,omitempty"`
}
type XenditPaymentRequestAction ¶ added in v1.0.8
type XenditPaymentRequestAction struct {
Type string `json:"type"`
Descriptor string `json:"descriptor"`
Value string `json:"value"`
}
XenditPaymentRequestAction is a redirect or auth action from payment request.
type XenditPaymentRequestCardDetails ¶ added in v1.0.8
type XenditPaymentRequestCardDetails struct {
Cvn string `json:"cvn,omitempty"`
}
XenditPaymentRequestCardDetails is card input for pay-with-token requests.
type XenditPaymentRequestChannelProperties ¶ added in v1.0.8
type XenditPaymentRequestChannelProperties struct {
SkipThreeDS *bool `json:"skip_three_ds,omitempty"`
CardOnFileType string `json:"card_on_file_type,omitempty"`
TransactionSequence string `json:"transaction_sequence,omitempty"`
SuccessReturnURL string `json:"success_return_url,omitempty"`
FailureReturnURL string `json:"failure_return_url,omitempty"`
StatementDescriptor string `json:"statement_descriptor,omitempty"`
CardDetails *XenditPaymentRequestCardDetails `json:"card_details,omitempty"`
}
XenditPaymentRequestChannelProperties is channel properties for POST /v3/payment_requests.
type XenditPaymentRequestResp ¶ added in v1.0.8
type XenditPaymentRequestResp struct {
PaymentRequestID string `json:"payment_request_id"`
ReferenceID string `json:"reference_id"`
PaymentTokenID string `json:"payment_token_id"`
CustomerID string `json:"customer_id"`
BusinessID string `json:"business_id"`
Type string `json:"type"`
Country string `json:"country"`
Currency string `json:"currency"`
ChannelCode string `json:"channel_code"`
RequestAmount float64 `json:"request_amount"`
CaptureMethod string `json:"capture_method"`
Status string `json:"status"`
ChannelProperties *XenditPaymentRequestChannelProperties `json:"channel_properties"`
Actions []XenditPaymentRequestAction `json:"actions"`
Description string `json:"description"`
Created string `json:"created"`
Updated string `json:"updated"`
XenditErrorResponse
}
XenditPaymentRequestResp is JSON response from payment request APIs.
func (*XenditPaymentRequestResp) AuthenticationURL ¶ added in v1.0.8
func (r *XenditPaymentRequestResp) AuthenticationURL() string
AuthenticationURL returns 3DS redirect URL from payment request actions.
type XenditPaymentResp ¶
type XenditPaymentResp struct {
PaymentURL string `json:"payment_url"`
}
XenditPaymentResp is standard response to Payment
type XenditPaymentSessionCardsChannelProperties ¶ added in v1.0.8
type XenditPaymentSessionCardsChannelProperties struct {
CardOnFileType string `json:"card_on_file_type,omitempty"`
TransactionSequence string `json:"transaction_sequence,omitempty"`
SkipThreeDS *bool `json:"skip_three_ds,omitempty"`
}
XenditPaymentSessionCardsChannelProperties is cards-specific channel properties.
type XenditPaymentSessionCardsSessionJS ¶ added in v1.0.8
type XenditPaymentSessionCardsSessionJS struct {
SuccessReturnURL string `json:"success_return_url"`
FailureReturnURL string `json:"failure_return_url"`
}
XenditPaymentSessionCardsSessionJS configures CARDS_SESSION_JS mode.
type XenditPaymentSessionChannelProperties ¶ added in v1.0.8
type XenditPaymentSessionChannelProperties struct {
Cards *XenditPaymentSessionCardsChannelProperties `json:"cards,omitempty"`
TransactionSequence string `json:"transaction_sequence,omitempty"`
CardOnFileType string `json:"card_on_file_type,omitempty"`
}
XenditPaymentSessionChannelProperties groups channel properties for sessions.
type XenditPaymentSessionCustomer ¶ added in v1.0.8
type XenditPaymentSessionCustomer struct {
ReferenceID string `json:"reference_id"`
Type string `json:"type"`
Email string `json:"email,omitempty"`
MobileNumber string `json:"mobile_number,omitempty"`
IndividualDetail *XenditPaymentSessionIndividualDetail `json:"individual_detail,omitempty"`
}
XenditPaymentSessionCustomer is customer payload for POST /sessions.
type XenditPaymentSessionIndividualDetail ¶ added in v1.0.8
type XenditPaymentSessionIndividualDetail struct {
GivenNames string `json:"given_names"`
Surname string `json:"surname"`
}
XenditPaymentSessionIndividualDetail is individual customer detail.
type XenditPaymentSessionResp ¶ added in v1.0.8
type XenditPaymentSessionResp struct {
PaymentSessionID string `json:"payment_session_id"`
ReferenceID string `json:"reference_id"`
CustomerID string `json:"customer_id"`
SessionType string `json:"session_type"`
Mode string `json:"mode"`
Currency string `json:"currency"`
Country string `json:"country"`
Amount interface{} `json:"amount"`
Status string `json:"status"`
PaymentLinkURL string `json:"payment_link_url"`
PaymentTokenID string `json:"payment_token_id"`
PaymentRequestID string `json:"payment_request_id"`
BusinessID string `json:"business_id"`
AllowSavePaymentMethod string `json:"allow_save_payment_method"`
CaptureMethod string `json:"capture_method"`
ChannelProperties *XenditPaymentSessionChannelProperties `json:"channel_properties"`
CardsSessionJS *XenditPaymentSessionCardsSessionJS `json:"cards_session_js"`
SuccessReturnURL string `json:"success_return_url"`
CancelReturnURL string `json:"cancel_return_url"`
ExpiresAt string `json:"expires_at"`
Created string `json:"created"`
Updated string `json:"updated"`
XenditErrorResponse
}
XenditPaymentSessionResp is JSON response from session APIs.
type XenditPaymentTokenCallback ¶ added in v1.0.8
type XenditPaymentTokenCallback struct {
Event string `json:"event"`
BusinessID string `json:"business_id"`
Created string `json:"created"`
Data struct {
PaymentTokenID string `json:"payment_token_id"`
ReferenceID string `json:"reference_id"`
Status string `json:"status"`
CustomerID string `json:"customer_id"`
ChannelCode string `json:"channel_code"`
TokenDetails *XenditPaymentTokenCardDetails `json:"token_details"`
CardDetails *XenditPaymentTokenCardDetails `json:"card_details"`
} `json:"data"`
}
XenditPaymentTokenCallback is webhook payload for payment_token.activated.
func (XenditPaymentTokenCallback) MaskedCardNumber ¶ added in v1.0.8
func (p XenditPaymentTokenCallback) MaskedCardNumber() string
MaskedCardNumber returns masked PAN from token activation webhook.
func (XenditPaymentTokenCallback) PaymentTokenID ¶ added in v1.0.8
func (p XenditPaymentTokenCallback) PaymentTokenID() string
PaymentTokenID returns payment_token_id from webhook payload.
type XenditPaymentTokenCardDetails ¶ added in v1.0.8
type XenditPaymentTokenCardDetails struct {
MaskedCardNumber string `json:"masked_card_number"`
CardBrand string `json:"card_brand"`
ExpiryMonth string `json:"expiry_month"`
ExpiryYear string `json:"expiry_year"`
}
XenditPaymentTokenCardDetails is masked card info from payment token.
type XenditPaymentTokenChannelProperties ¶ added in v1.0.8
type XenditPaymentTokenChannelProperties struct {
CardDetails *XenditPaymentTokenCardDetails `json:"card_details"`
}
XenditPaymentTokenChannelProperties is channel_properties on payment token responses.
type XenditPaymentTokenResp ¶ added in v1.0.8
type XenditPaymentTokenResp struct {
PaymentTokenID string `json:"payment_token_id"`
ReferenceID string `json:"reference_id"`
CustomerID string `json:"customer_id"`
BusinessID string `json:"business_id"`
Country string `json:"country"`
Currency string `json:"currency"`
ChannelCode string `json:"channel_code"`
Status string `json:"status"`
TokenDetails *XenditPaymentTokenCardDetails `json:"token_details"`
CardDetails *XenditPaymentTokenCardDetails `json:"card_details"`
ChannelProperties *XenditPaymentTokenChannelProperties `json:"channel_properties"`
Created string `json:"created"`
Updated string `json:"updated"`
XenditErrorResponse
// contains filtered or unexported fields
}
XenditPaymentTokenResp is JSON response from payment token APIs.
func (*XenditPaymentTokenResp) MaskedCardNumber ¶ added in v1.0.8
func (r *XenditPaymentTokenResp) MaskedCardNumber() string
MaskedCardNumber returns masked PAN from token response.
type XenditQrCodeCallback ¶ added in v1.0.5
type XenditQrCodeCallback struct {
Event string `json:"event"`
ApiVersion string `json:"api_version"`
BusinessId string `json:"business_id"`
CreatedDateTime string `json:"created"`
Data []XenditQrCodeResp `json:"data"`
}
XenditQrCodeCallback is standard callback when payment
type XenditQrCodeResp ¶ added in v1.0.5
type XenditQrCodeResp struct {
Id string `json:"id"`
ReferenceId string `json:"reference_id"`
BusinessId string `json:"business_id"`
Type string `json:"type"`
Currency string `json:"currency"`
Amount float64 `json:"amount"`
ChannelCode string `json:"channel_code"`
Status string `json:"status"`
QrString string `json:"qr_string"`
Description string `json:"description"`
ExpiryDate string `json:"expires_at"`
CreatedDateTime string `json:"created"`
UpdatedDateTime string `json:"updated" `
Basket []BasketQrCode `json:"basket"`
PaymentDetails
XenditErrorResponse
}
type XenditUpdateFixedVaReq ¶ added in v1.0.7
type XenditUpdateFixedVaReq struct {
Name string `json:"name,omitempty"`
ExpectedAmount float64 `json:"expected_amount,omitempty"`
IsClosed *bool `json:"is_closed,omitempty"`
IsSingleUse *bool `json:"is_single_use,omitempty"`
ExpirationDate string `json:"expiration_date,omitempty"`
VirtualAccountNumber string `json:"virtual_account_number,omitempty"`
}
type XenditVerifyPaymentResponse ¶
type XenditVerifyPaymentResponse struct {
ID string `json:"id"`
PaymentID string `json:"payment_id"`
CallbackVirtualAccountID string `json:"callback_virtual_account_id"`
ExternalID string `json:"external_id"`
MerchantCode string `json:"merchant_code"`
AccountNumber string `json:"account_number"`
BankCode string `json:"bank_code"`
Amount float64 `json:"amount"`
TransactionTimestamp string `json:"transaction_timestamp"`
}
XenditVerifyPaymentResponse type response when verifying payment notification