xendit

package module
v1.0.58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 11 Imported by: 0

README

Xendit API Go Client

go.dev reference Coverage Status Go Report Card

This library is the abstraction of Xendit API for access from applications written with Go.

Documentation

For the API documentation, check Xendit API Reference.

For the details of this library, see the GoDoc.

Installation

Install xendit-go with:

go get -u github.com/ianeinser/xendit-go

Then, import it using:

import (
    "github.com/ianeinser/xendit-go"
    "github.com/ianeinser/xendit-go/$product$"
)

with $product$ is the product of Xendit such as invoice and balance.

Go Module Support

This library supports Go modules by default. Simply require xendit-go in go.mod with a version like so:

module github.com/my/package

go 1.13

require (
  github.com/ianeinser/xendit-go v1.0.0
)

And use the same style of import paths as above:

import (
    "github.com/ianeinser/xendit-go"
    "github.com/ianeinser/xendit-go/$product$"
)

with $product$ is the product of Xendit such as invoice and balance.

Using xendit-go with $GOPATH

If you are still using $GOPATH and not planning to migrate to go mod, installing xendit-go would require installing its (only) dependency validator via

go get -u github.com/go-playground/validator

Please note that this means you are using master of validator and effectively miss out on its versioning that's gomod-based.

After installing validator, xendit-go can be installed normally.

Usage

The following pattern is applied throughout the library for a given $product$:

Without Client

If you're only dealing with a single secret key, you can simply import the packages required for the products you're interacting with without the need to create a client.

import (
    "github.com/ianeinser/xendit-go"
    "github.com/ianeinser/xendit-go/$product$"
)

// Setup
xendit.Opt.SecretKey = "examplesecretkey"

xendit.SetAPIRequester(apiRequester) // optional, useful for mocking

// Create
resp, err := $product$.Create($product$.CreateParams)

// Get
resp, err := $product$.Get($product$.GetParams)

// GetAll
resp, err := $product$.GetAll($product$.GetAllParams)
With Client

If you're dealing with multiple secret keys, it is recommended you use client.API. This allows you to create as many clients as needed, each with their own individual key.

import (
    "github.com/ianeinser/xendit-go"
    "github.com/ianeinser/xendit-go/client"
)

// Basic setup
xenCli := client.New("examplesecretkey")

// or with optional, useful-for-mocking `exampleAPIRequester`
xenCli := client.New("examplesecretkey").WithAPIRequester(exampleAPIRequester)

// Create
resp, err := xenCli.$product$.Create($product$.CreateParams)

// Get
resp, err := xenCli.$product$.Get($product$.GetParams)

// GetAll
resp, err := xenCli.$product$.GetAll($product$.GetAllParams)
Sub-Packages Documentations

The following is a list of pointers to documentations for sub-packages of xendit-go.

Contribute

For any requests, bugs, or comments, please open an issue or submit a pull request.

Test

After modifying the code, please make sure that the code passes all test cases.

Run all tests
go test ./...
Run tests for a package
go test ./invoice
Run a single test
go test ./invoice -run TestCreateInvoice
Run integration tests
SECRET_KEY=<your secret key> go run -race ./integration_test
Pre-commit

Before making any commits, please install pre-commit. To install pre-commit, follow the installation steps.

After installing the pre-commit, please install the needed dependencies:

make init

After the code passes everything, please submit a pull request.

Documentation

Overview

Package xendit provides the binding for Xendit APIs.

Index

Examples

Constants

View Source
const (
	// APIValidationErrCode error code for parameters validation
	APIValidationErrCode string = "API_VALIDATION_ERROR"
	// GoErrCode error code for errors happen inside Go code
	GoErrCode string = "GO_ERROR"
)

Contains constants for the ErrorCode in xendit.Error

Variables

This section is empty.

Functions

func SetAPIRequester

func SetAPIRequester(apiRequester APIRequester)

SetAPIRequester sets the APIRequester for API call

func SetHTTPClient

func SetHTTPClient(newHTTPClient *http.Client)

SetHTTPClient sets the httpClient for API call

Types

type APIRequester

type APIRequester interface {
	Call(ctx context.Context, method string, url string, secretKey string, header http.Header, body interface{}, result interface{}) *Error
}

APIRequester abstraction of HTTP Client that will make API calls to Xendit backend. `body` is POST-requests' bodies if applicable. `result` pointer to value which response string will be unmarshalled to.

func GetAPIRequester

func GetAPIRequester() APIRequester

GetAPIRequester returns the xendit APIRequester. If it is already created, it will return the created one. Else, it will create a default implementation.

type APIRequesterImplementation

type APIRequesterImplementation struct {
	HTTPClient *http.Client
}

APIRequesterImplementation is the default implementation of APIRequester

func (*APIRequesterImplementation) Call

func (a *APIRequesterImplementation) Call(ctx context.Context, method string, url string, secretKey string, header http.Header, body interface{}, result interface{}) *Error

Call makes HTTP requests with JSON-format body. `body` is POST-requests' bodies if applicable. `result` pointer to value which response string will be unmarshalled to.

type APIRequesterWrapper

type APIRequesterWrapper struct {
	// contains filtered or unexported fields
}

APIRequesterWrapper is the APIRequester with locker for setting the APIRequester

type AccessibleLinkedAccount

type AccessibleLinkedAccount struct {
	ID          string                 `json:"id"`
	ChannelCode ChannelCodeEnum        `json:"channel_code"`
	AccountType AccountTypeEnum        `json:"type"`
	Properties  map[string]interface{} `json:"properties"`
}

AccessibleLinkedAccount contains data from Xendit's API response of get accessible linked account related requests. For more details see https://xendit.github.io/apireference/?bash#retrieve-accessible-accounts-by-linked-account-token. For documentation of subpackage linked account, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebit/linkedaccount/

type Account

type Account struct {
	ID            string        `json:"id,omitempty"`
	Created       *time.Time    `json:"created,omitempty"`
	Updated       *time.Time    `json:"updated,omitempty"`
	Type          AccountType   `json:"type,omitempty"`
	Email         string        `json:"email,omitempty"`
	PublicProfile PublicProfile `json:"public_profile,omitempty"`
	Country       string        `json:"country,omitempty"`
	Status        Status        `json:"status,omitempty"`
}

type Account2

type Account2 struct {
	AccountDetails string  `json:"account_details,omitempty"`
	Name           string  `json:"name,omitempty"`
	Balance        float64 `json:"balance,omitempty"`
	PointBalance   float64 `json:"point_balance,omitempty"`
}

type AccountType

type AccountType string
const (
	OWNED   AccountType = "OWNED"
	MANAGED AccountType = "MANAGED"
)

type AccountTypeEnum

type AccountTypeEnum string

AccountType constants are the available account type

const (
	DEBIT_CARD   AccountTypeEnum = "DEBIT_CARD"
	BANK_ACCOUNT AccountTypeEnum = "BANK_ACCOUNT"
)

This consists the values that AccountTypeEnum can take

type Actions

type Actions struct {
	DesktopWebCheckoutURL     *string `json:"desktop_web_checkout_url"`
	MobileWebCheckoutURL      *string `json:"mobile_web_checkout_url"`
	MobileDeeplinkCheckoutURL *string `json:"mobile_deeplink_checkout_url"`
	QrCheckoutString          *string `json:"qr_checkout_string"`
}

Actions represents the actions of an Ewallet Charge.

type Actions2

type Actions2 struct {
	ReferenceID string `json:"-"`
	Method      string `json:"method,omitempty"`
	UrlType     string `json:"url_type,omitempty"`
	Action      string `json:"action,omitempty"`
	Url         string `json:"url,omitempty"`
}

type AmountLimits

type AmountLimits struct {
	Minimum          float64 `json:"minimum"`
	Maximum          float64 `json:"maximum"`
	MinimumIncrement float64 `json:"minimum_increment"`
}

AmountLimits is data that contained in DisbursementChannel at Amount Limit.

type Balance

type Balance struct {
	Balance float64 `json:"balance"`
}

Balance contains data from Xendit's API response of balance related request. For more details see https://xendit.github.io/apireference/?bash#balances. For documentation of subpackage balance, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/balance

type BalanceAccountTypeEnum

type BalanceAccountTypeEnum string

BalanceAccountTypeEnum constants are the available balance account type

const (
	BalanceAccountTypeCash    BalanceAccountTypeEnum = "CASH"
	BalanceAccountTypeHolding BalanceAccountTypeEnum = "HOLDING"
	BalanceAccountTypeTax     BalanceAccountTypeEnum = "TAX"
)

This consists the values that BalanceAccountType can take

func (*BalanceAccountTypeEnum) String

func (b *BalanceAccountTypeEnum) String() string

String returns the BalanceAccountTypeEnum in type string

type BankAccount

type BankAccount struct {
	MaskedBankAccountNumber string `json:"masked_bank_account_number,omitempty"`
	BankAccountHash         string `json:"bank_account_hash,omitempty"`
}

type BatchDisbursement

type BatchDisbursement struct {
	Created             *time.Time `json:"created"`
	Reference           string     `json:"reference"`
	TotalUploadedAmount float64    `json:"total_uploaded_amount"`
	TotalUploadedCount  int        `json:"total_uploaded_count"`
	Status              string     `json:"status"`
	ID                  string     `json:"id"`
}

BatchDisbursement contains data from Xendit's API response of batch disbursement. For more details see https://xendit.github.io/apireference/?bash#batch-disbursement.

type Beneficiary

type Beneficiary struct {
	Type         string `json:"type"`
	GivenNames   string `json:"given_names"`
	MiddleName   string `json:"middle_name"`
	Surname      string `json:"surname"`
	BusinessName string `json:"business_name"`
	StreetLine1  string `json:"street_line1"`
	StreetLine2  string `json:"street_line2"`
	City         string `json:"city"`
	Province     string `json:"province"`
	State        string `json:"state"`
	Country      string `json:"country"`
	ZipCode      string `json:"zip_code"`
	MobileNumber string `json:"mobile_number"`
	PhoneNumber  string `json:"phone_number"`
	Email        string `json:"email"`
}

Beneficiary is data that contained in Create at Beneficiary

type BillingInformation

type BillingInformation struct {
	Country       string `json:"country,omitempty"`
	StreetLine1   string `json:"street_line1,omitempty"`
	StreetLine2   string `json:"street_line2,omitempty"`
	City          string `json:"city,omitempty"`
	ProvinceState string `json:"province_state,omitempty"`
	PostalCode    string `json:"postal_code,omitempty"`
}

type BusinessDetail

type BusinessDetail struct {
	BusinessName       string `json:"business_name,omitempty"`
	BusinessType       string `json:"business_type,omitempty"`
	NatureOfBusiness   string `json:"nature_of_business,omitempty"`
	BusinessDomicile   string `json:"business_domicile,omitempty"`
	DateOfRegistration string `json:"date_of_registration,omitempty"`
}

type Card

type Card struct {
	Currency          string            `json:"currency"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
	CardInformation   CardInformation   `json:"card_information" gorm:"embedded;embeddedPrefix:ci_"`
}

type CardCharge

type CardCharge struct {
	ID                    string     `json:"id"`
	Status                string     `json:"status"`
	MerchantID            string     `json:"merchant_id"`
	Created               *time.Time `json:"created"`
	BusinessID            string     `json:"business_id"`
	AuthorizedAmount      float64    `json:"authorized_amount"`
	ExternalID            string     `json:"external_id"`
	MerchantReferenceCode string     `json:"merchant_reference_code"`
	ChargeType            string     `json:"charge_type"`
	CardBrand             string     `json:"card_brand"`
	MaskedCardNumber      string     `json:"masked_card_number"`
	CaptureAmount         float64    `json:"capture_amount,omitempty"`
	ECI                   string     `json:"eci,omitempty"`
	FailureReason         string     `json:"failure_reason,omitempty"`
	CardType              string     `json:"card_type,omitempty"`
	BankReconciliationID  string     `json:"bank_reconciliation_id,omitempty"`
	Descriptor            string     `json:"descriptor,omitempty"`
	MidLabel              string     `json:"mid_label,omitempty"`
	Currency              string     `json:"currency,omitempty"`
}

CardCharge contains data from Xendit's API response of card's charge related requests and Create Authorization request. For more details see https://xendit.github.io/apireference/?bash#create-charge and https://xendit.github.io/apireference/?bash#create-authorization. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/card

type CardInformation

type CardInformation struct {
	TokenID          string `json:"token_id"`
	CardNumber       string `json:"card_number,omitempty"`
	MaskedCardNumber string `json:"masked_card_number"`
	ExpiryMonth      string `json:"expiry_month"`
	ExpiryYear       string `json:"expiry_year"`
	CardholderName   string `json:"cardholder_name,omitempty"`
	Cvv              string `json:"cvv,omitempty"`
	Fingerprint      string `json:"fingerprint,omitempty"`
	Type             string `json:"type,omitempty"`
	Network          string `json:"network,omitempty"`
	Country          string `json:"country,omitempty"`
	Issuer           string `json:"issuer,omitempty"`
}

type CardRefund

type CardRefund struct {
	ID                 string     `json:"id"`
	Updated            *time.Time `json:"updated"`
	Created            *time.Time `json:"created"`
	CreditCardChargeID string     `json:"credit_card_charge_id"`
	UserID             string     `json:"user_id"`
	Amount             float64    `json:"amount"`
	ExternalID         string     `json:"external_id"`
	Currency           string     `json:"currency"`
	Status             string     `json:"status"`
	FeeRefundAmount    float64    `json:"fee_refund_amount"`
	FailureReason      string     `json:"failure_reason"`
}

CardRefund contains data from Xendit's API response of card's Create Refund request. For more details see https://xendit.github.io/apireference/?bash#CreateRefund. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/card

type CardReverseAuthorization

type CardReverseAuthorization struct {
	ID                 string     `json:"id"`
	ExternalID         string     `json:"external_id"`
	CreditCardChargeID string     `json:"credit_card_charge_id"`
	BusinessID         string     `json:"business_id"`
	Amount             float64    `json:"amount"`
	Status             string     `json:"status"`
	Created            *time.Time `json:"created"`
	Currency           string     `json:"currency,omitempty"`
}

CardReverseAuthorization contains data from Xendit's API response of card's Reverse Authorization request. For more details see https://xendit.github.io/apireference/?bash#reverse-authorization. For documentation of subpackage card, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/card

type CardVerificationResults

type CardVerificationResults struct {
	ThreeDSecure              ThreeDSecure `json:"three_d_secure,omitempty" gorm:"embedded;embeddedPrefix:tds_"`
	CvvResult                 string       `json:"cvv_result,omitempty"`
	AddressVerificationResult string       `json:"addres_verification_result,omitempty"`
}

type CardlessCredit

type CardlessCredit struct {
	RedirectURL        string                 `json:"redirect_url"`
	TransactionID      string                 `json:"transaction_id"`
	OrderID            string                 `json:"order_id"`
	ExternalID         string                 `json:"external_id"`
	CardlessCreditType CardlessCreditTypeEnum `json:"cardless_credit_type"`
}

CardlessCredit contains data from Xendit's API response of cardless credit related requests. For more details see https://xendit.github.io/apireference/?bash#cardless-credit. For documentation of subpackage cardlesscredit, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/cardlesscredit

type CardlessCreditTypeEnum

type CardlessCreditTypeEnum string

CardlessCreditTypeEnum constants are the available cardless credit types

const (
	CardlessCreditTypeEnumKREDIVO CardlessCreditTypeEnum = "KREDIVO"
)

This consists the values that CardlessCreditTypeEnum can take

type ChannelCodeEnum

type ChannelCodeEnum string

ChannelCodeEnum constants are the available channel code

const (
	DC_BRI ChannelCodeEnum = "DC_BRI"
	BA_BPI ChannelCodeEnum = "BA_BPI"
	BA_UBP ChannelCodeEnum = "BA_UBP"
)

This consists the values that ChannelCodeEnum can take

type ChannelProperties

type ChannelProperties struct {
	RedeemPoints         string `json:"redeem_properties,omitempty"`
	SuccessReturnUrl     string `json:"success_return_url,omitempty"`
	FailureReturnUrl     string `json:"failure_return_url,omitempty"`
	CancelReturnUrl      string `json:"cancel_return_url,omitempty"`
	RequiredAuth         string `json:"required_auth,omitempty"`
	MobileNumber         string `json:"mobile_number,omitempty"`
	Cashtag              string `json:"cashtag,omitempty"`
	CardLastFour         string `json:"card_last_four,omitempty"`
	CardExpiry           string `json:"card_expiry,omitempty"`
	Email                string `json:"email,omitempty"`
	SkipThreeDSecure     bool   `json:"skip_three_d_secure,omitempty"`
	CardOnFileType       string `json:"cardonfile_type,omitempty"`
	CustomerName         string `json:"customer_name,omitempty"`
	PaymentCode          string `json:"payment_code,omitempty"`
	ExpiresAt            string `json:"expires_at,omitempty"`
	VirtualAccountNumber string `json:"virtual_account_number,omitempty"`
	SuggestedAmount      string `json:"suggested_amount,omitempty"`
	QrString             string `json:"qr_string"`
}

type ChargeOutputStatus

type ChargeOutputStatus string

ChargeOutputStatus represents the enum for charge output status for an Ewallet Charge

const (
	ChargeOutputStatusPending   ChargeOutputStatus = "PENDING"
	ChargeOutputStatusFailed    ChargeOutputStatus = "FAILED"
	ChargeOutputStatusSucceeded ChargeOutputStatus = "SUCCEEDED"
	ChargeOutputStatusVoided    ChargeOutputStatus = "VOIDED"
	ChargeOutputStatusRefunded  ChargeOutputStatus = "REFUNDED"
)

These are the available ChargeOutputStatus values for an Ewallet Charge

type Customer

type Customer struct {
	ID                string            `json:"id"`
	ReferenceID       string            `json:"reference_id"`
	Type              string            `json:"type"`
	IndividualDetail  IndividualDetail  `json:"individual_detail,omitempty" gorm:"embedded;embeddedPrefix:id_"`
	BusinessDetail    BusinessDetail    `json:"business_detail,omitempty" gorm:"embedded;embeddedPrefix:bd_"`
	MobileNumber      string            `json:"mobile_number,omitempty"`
	Email             string            `json:"email,omitempty"`
	Description       string            `json:"description,omitempty"`
	PhoneNumber       string            `json:"phone_number"`
	HashedPhoneNumber string            `json:"hashed_phone_number"`
	Addresses         []CustomerAddress `json:"addresses,omitempty" gorm:"foreignKey:ReferenceID;references:ReferenceID"`
	Metadata          datatypes.JSONMap `json:"metadata"`
}

Customer contains data from Xendit's API response of customer related requests. For more details see https://xendit.github.io/apireference/?bash#customers. For documentation of subpackage customer, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/customer/

type CustomerAddress

type CustomerAddress struct {
	ReferenceID string `json:"-"`
	Country     string `json:"country" validate:"required"`
	StreetLine1 string `json:"street_line1,omitempty"`
	StreetLine2 string `json:"street_line2,omitempty"`
	City        string `json:"city,omitempty"`
	Province    string `json:"province,omitempty"`
	State       string `json:"state,omitempty"`
	PostalCode  string `json:"postal_code,omitempty"`
	Category    string `json:"category,omitempty"`
	IsPreferred bool   `json:"is_preferred,omitempty"`
}

CustomerAddress contains data from Xendit's API response of customer's Customer Addres requests. For more details see https://xendit.github.io/apireference/?bash#customers. For documentation of subpackage customer, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/customer/

type CustomerNotificationChannelEnum

type CustomerNotificationChannelEnum string

CustomerNotificationChannelEnum constants are the available customer notification channels

const (
	CustomerNotificationChannelWhatsApp CustomerNotificationChannelEnum = "whatsapp"
	CustomerNotificationChannelSMS      CustomerNotificationChannelEnum = "sms"
	CustomerNotificationChannelEmail    CustomerNotificationChannelEnum = "email"
	CustomerNotificationChannelViber    CustomerNotificationChannelEnum = "viber"
)

This consists the values that CustomerNotificationChannelEnum can take

type CustomerNotificationPreference

type CustomerNotificationPreference struct {
	InvoiceCreated  []CustomerNotificationChannelEnum `json:"invoice_created,omitempty"`
	InvoiceReminder []CustomerNotificationChannelEnum `json:"invoice_reminder,omitempty"`
	InvoicePaid     []CustomerNotificationChannelEnum `json:"invoice_paid,omitempty"`
	InvoiceExpired  []CustomerNotificationChannelEnum `json:"invoice_expired,omitempty"`
}

CustomerNotificationPreference is data that contained in `RecurringPayment` at CustomerNotificationPreference

type DebitCard

type DebitCard struct {
	MobileNumber string `json:"mobile_number,omitempty"`
	CardLastFour string `json:"card_last_four,omitempty"`
	CardExpiry   string `json:"card_expiry,omitempty"`
	Email        string `json:"email,omitempty"`
}

type DirectDebit

type DirectDebit struct {
	ChannelCode       string            `json:"channel_code"`
	Type              string            `json:"type,omitempty"`
	ChannelProperties ChannelProperties `json:"channel_properties,omitempty" gorm:"embedded;embeddedPrefix:cpros_"`
	BankAccount       BankAccount       `json:"bank_account,omitempty" gorm:"embedded;embeddedPrefix:bacc_"`
	DebitCard         DebitCard         `json:"debit_card,omitempty" gorm:"embedded;embeddedPrefix:dc_"`
}

type DirectDebitBasketItem

type DirectDebitBasketItem struct {
	ReferenceID string                 `json:"reference_id"`
	Name        string                 `json:"name"`
	Market      string                 `json:"market"`
	Type        string                 `json:"type"`
	Description string                 `json:"description,omitempty"`
	Category    string                 `json:"category,omitempty"`
	SubCategory string                 `json:"sub_category,omitempty"`
	Price       float64                `json:"price,omitempty"`
	URL         string                 `json:"url,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	Quantity    int                    `json:"quantity,omitempty"`
}

DirectDebitBasketItem contains data from Xendit's API response of direct debit's basket requests. For more details see https://xendit.github.io/apireference/?bash#create-direct-debit-payment. For documentation of subpackage direct debit payment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebitpayment/

type DirectDebitDevice

type DirectDebitDevice struct {
	ID        string `json:"id"`
	IPAddress string `json:"ip_address"`
	UserAgent string `json:"user_agent"`
	ADID      string `json:"ad_id,omitempty"`
	Imei      string `json:"imei,omitempty"`
}

DirectDebitDevice contains data from Xendit's API response of direct debit's device requests. For more details see https://xendit.github.io/apireference/?bash#create-direct-debit-payment. For documentation of subpackage direct debit payment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebitpayment/

type DirectDebitPayment

type DirectDebitPayment struct {
	ID                     string                  `json:"id"`
	ReferenceID            string                  `json:"reference_id"`
	ChannelCode            ChannelCodeEnum         `json:"channel_code"`
	PaymentMethodID        string                  `json:"payment_method_id"`
	Currency               string                  `json:"currency"`
	Amount                 float64                 `json:"amount"`
	Description            string                  `json:"description"`
	Status                 string                  `json:"status"`
	FailureCode            string                  `json:"failure_code"`
	IsOTPRequired          bool                    `json:"is_otp_required"`
	OTPMobileNumber        string                  `json:"otp_mobile_number"`
	OTPExpirationTimestamp string                  `json:"otp_expiration_timestamp"`
	Created                string                  `json:"created"`
	Updated                string                  `json:"updated"`
	Basket                 []DirectDebitBasketItem `json:"basket"`
	Metadata               map[string]interface{}  `json:"metadata"`
	Device                 DirectDebitDevice       `json:"device"`
	RefundedAmount         float64                 `json:"refunded_amount"`
	Refunds                DirectDebitRefunds      `json:"refunds"`
	SuccessRedirectURL     string                  `json:"success_redirect_url"`
	CheckoutURL            string                  `json:"checkout_url"`
	FailureRedirectURL     string                  `json:"failure_redirect_url"`
	RequiredAction         string                  `json:"required_action"`
}

DirectDebitPayment contains data from Xendit's API response of direct debit payment requests. For more details see https://xendit.github.io/apireference/?bash#create-direct-debit-payment. For documentation of subpackage direct debit payment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebitpayment/

type DirectDebitRefunds

type DirectDebitRefunds struct {
	Data    []string `json:"data"`
	HasMore bool     `json:"has_more"`
	URL     string   `json:"url"`
}

DirectDebitRefunds contains data from Xendit's API response of direct debit's refunds requests. For more details see https://xendit.github.io/apireference/?bash#create-direct-debit-payment. For documentation of subpackage direct debit payment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebitpayment/

type Disbursement

type Disbursement struct {
	ID                      string         `json:"id"`
	UserID                  string         `json:"user_id"`
	ExternalID              string         `json:"external_id"`
	Amount                  float64        `json:"amount"`
	BankCode                string         `json:"bank_code"`
	AccountHolderName       string         `json:"account_holder_name"`
	DisbursementDescription string         `json:"disbursement_description"`
	Status                  string         `json:"status"`
	EmailTo                 pq.StringArray `json:"email_to,omitempty" gorm:"type:text[]"`
	EmailCC                 pq.StringArray `json:"email_cc,omitempty" gorm:"type:text[]"`
	EmailBCC                pq.StringArray `json:"email_bcc,omitempty" gorm:"type:text[]"`
	IsInstant               bool           `json:"is_instant,omitempty"`
	FailureCode             string         `json:"failure_code,omitempty"`
}

Disbursement contains data from Xendit's API response of disbursement related requests. For more details see https://xendit.github.io/apireference/?bash#disbursement. For documentation of subpackage disbursement, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/disbursement

Example (CreateWithClient)
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/ianeinser/xendit-go/client"
	"github.com/ianeinser/xendit-go/disbursement"
)

func main() {
	cli := client.New("xnd_...")

	availableBanks, err := cli.Disbursement.GetAvailableBanks()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("available disbursement banks: %+v\n", availableBanks)

	createData := disbursement.CreateParams{
		IdempotencyKey:    "disbursement" + time.Now().String(),
		ExternalID:        "disbursement-external",
		BankCode:          availableBanks[0].Code,
		AccountHolderName: "Michael Jackson",
		AccountNumber:     "1234567890",
		Description:       "Disbursement from Go",
		Amount:            200000,
	}

	resp, err := cli.Disbursement.Create(&createData)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("created disbursement: %+v\n", resp)
}
Output:

Example (CreateWithoutClient)
xendit.Opt.SecretKey = "xnd_..."

availableBanks, err := disbursement.GetAvailableBanks()
if err != nil {
	log.Fatal(err)
}
fmt.Printf("available disbursement banks: %+v\n", availableBanks)

createData := disbursement.CreateParams{
	IdempotencyKey:    "disbursement" + time.Now().String(),
	ExternalID:        "disbursement-external",
	BankCode:          availableBanks[0].Code,
	AccountHolderName: "Michael Jackson",
	AccountNumber:     "1234567890",
	Description:       "Disbursement from Go",
	Amount:            200000,
}

resp, err := disbursement.Create(&createData)
if err != nil {
	log.Fatal(err)
}
fmt.Printf("created disbursement: %+v\n", resp)
Output:

type DisbursementBank

type DisbursementBank struct {
	Name            string `json:"name"`
	Code            string `json:"code"`
	CanDisburse     bool   `json:"can_disburse"`
	CanNameValidate bool   `json:"can_name_validate"`
}

DisbursementBank contains data from Xendit's API response of Get Disbursement Banks.

type DisbursementChannel

type DisbursementChannel struct {
	ChannelCode     string       `json:"channel_code"`
	Name            string       `json:"name"`
	ChannelCategory string       `json:"channel_category"`
	AmountLimits    AmountLimits `json:"amount_limits" gorm:"embedded;embeddedPrefix:al_"`
	Currency        string       `json:"currency"`
}

DisbursementChannel contains data from Xendit's API response of Get Disbursement Channels.

type DisbursementPh

type DisbursementPh struct {
	ID                  string              `json:"id"`
	ReferenceID         string              `json:"reference_id"`
	Currency            string              `json:"currency"`
	Amount              float64             `json:"amount"`
	ChannelCode         string              `json:"channel_code"`
	Description         string              `json:"description"`
	Status              string              `json:"status"`
	Created             *time.Time          `json:"created,omitempty"`
	Updated             *time.Time          `json:"updated,omitempty"`
	ReceiptNotification ReceiptNotification `json:"receipt_notification" gorm:"embedded;embeddedPrefix:rn_"`
	Metadata            datatypes.JSONMap   `json:"metadata,omitempty"`
	FailureCode         string              `json:"failure_code,omitempty"`
}

Disbursement contains data from Xendit's API response of disbursement related requests. For more details see https://docs.google.com/document/d/1eK7rt6AwMZHcAN1wxgqhsesQ_im35t2Q9iuM7bOXI04/edit#. For documentation of subpackage disbursement, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/disbursement

type EWallet

type EWallet struct {
	EWalletType          EWalletTypeEnum `json:"ewallet_type"`
	ExternalID           string          `json:"external_id"`
	Status               string          `json:"status"`
	Amount               float64         `json:"amount"`
	TransactionDate      *time.Time      `json:"transaction_date,omitempty"`
	CheckoutURL          string          `json:"checkout_url,omitempty"`
	BusinessID           string          `json:"business_id,omitempty"`
	Created              *time.Time      `json:"created,omitempty"`
	EWalletTransactionID string          `json:"e_wallet_transaction_id,omitempty"`
}

EWallet contains data from Xendit's API response of e-wallet related requests. For more details see https://xendit.github.io/apireference/?bash#ewallets. For documentation of subpackage ewallet, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/ewallet

type EWalletBasketItem

type EWalletBasketItem struct {
	ReferenceID string                 `json:"reference_id" validate:"required"`
	Name        string                 `json:"name" validate:"required"`
	Category    string                 `json:"category" validate:"required"`
	Currency    string                 `json:"currency" validate:"required"`
	Price       float64                `json:"price" validate:"required"`
	Quantity    int                    `json:"quantity" validate:"required"`
	Type        string                 `json:"type" validate:"required"`
	Url         string                 `json:"url,omitempty"`
	Description string                 `json:"description,omitempty"`
	SubCategory string                 `json:"sub_category,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

type EWalletCharge

type EWalletCharge struct {
	ID                   string                 `json:"id"`
	BusinessID           string                 `json:"business_id"`
	ReferenceID          string                 `json:"reference_id"`
	Status               ChargeOutputStatus     `json:"status"`
	Currency             string                 `json:"currency"`
	ChargeAmount         float64                `json:"charge_amount"`
	CaptureAmount        float64                `json:"capture_amount"`
	PayerChargedCurrency string                 `json:"payer_charged_currency,omitempty"`
	PayerChargedAmount   float64                `json:"payer_charged_amount,omitempty"`
	RefundedAmount       float64                `json:"refunded_amount,omitempty"`
	CheckoutMethod       string                 `json:"checkout_method"`
	ChannelCode          string                 `json:"channel_code"`
	ChannelProperties    map[string]string      `json:"channel_properties"`
	Actions              Actions                `json:"actions"`
	IsRedirectRequired   bool                   `json:"is_redirect_required"`
	CallbackURL          string                 `json:"callback_url"`
	Created              string                 `json:"created"`
	Updated              string                 `json:"updated"`
	VoidStatus           string                 `json:"void_status,omitempty"`
	VoidedAt             string                 `json:"voided_at,omitempty"`
	CaptureNow           bool                   `json:"capture_now"`
	CustomerID           string                 `json:"customer_id,omitempty"`
	Customer             *EwalletCustomer       `json:"customer,omitempty"`
	PaymentMethodID      string                 `json:"payment_method_id,omitempty"`
	FailureCode          string                 `json:"failure_code,omitempty"`
	Basket               []EWalletBasketItem    `json:"basket,omitempty"`
	Metadata             map[string]interface{} `json:"metadata,omitempty"`
	ShippingInformation  *ShippingInformation   `json:"shipping_information,omitempty"`
}

EWalletCharge represents the response from Xendit Ewallet Charge API

type EWalletTypeEnum

type EWalletTypeEnum string

EWalletTypeEnum constants are the available e-wallet type for Ewallet Payment

const (
	EWalletTypeOVO       EWalletTypeEnum = "OVO"
	EWalletTypeDANA      EWalletTypeEnum = "DANA"
	EWalletTypeLINKAJA   EWalletTypeEnum = "LINKAJA"
	EWalletTypeSHOPEEPAY EWalletTypeEnum = "SHOPEEPAY"
	EWalletTypeGCASH     EWalletTypeEnum = "GCASH"
	EWalletTypeGRABPAY   EWalletTypeEnum = "GRABPAY"
	EWalletTypePAYMAYA   EWalletTypeEnum = "PAYMAYA"
)

This consists the values that EWalletTypeEnum can take

type Employment

type Employment struct {
	EmployerName     string `json:"employer_name,omitempty"`
	NatureOfBusiness string `json:"nature_of_business,omitempty"`
	RoleDescription  string `json:"role_description,omitempty"`
}

type Error

type Error struct {
	Status    int    `json:"status,omitempty"`
	ErrorCode string `json:"error_code,omitempty"`
	Message   string `json:"message,omitempty"`
}

Error is the conventional Xendit error

func FromGoErr

func FromGoErr(err error) *Error

FromGoErr generates xendit.Error from generic go errors

func FromHTTPErr

func FromHTTPErr(status int, respBody []byte) *Error

FromHTTPErr generates xendit.Error from http errors with non 2xx status

func (*Error) Error

func (e *Error) Error() string

Error returns error message. This enables xendit.Error to comply with Go error interface

func (*Error) GetErrorCode

func (e *Error) GetErrorCode() string

GetErrorCode returns error code coming from xendit backend

func (*Error) GetStatus

func (e *Error) GetStatus() int

GetStatus returns http status code

type Ewallet

type Ewallet struct {
	ChannelCode       string            `json:"channel_code"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
	Account           Account2          `json:"account,omitempty" gorm:"embedded;embeddedPrefix:acc_"`
}

type EwalletCustomer

type EwalletCustomer struct {
	ReferenceId            *string `json:"reference_id,omitempty"`
	GivenNames             *string `json:"given_names,omitempty"`
	Surname                *string `json:"surname,omitempty"`
	Email                  *string `json:"email,omitempty"`
	MobileNumber           *string `json:"mobile_number,omitempty"`
	DomicileOfRegistration *string `json:"domicile_of_registration,omitempty"`
	DateOfRegistration     *string `json:"date_of_registration,omitempty"`
}

type IndividualDetail

type IndividualDetail struct {
	GivenNames   string     `json:"given_names,omitempty"`
	Surname      string     `json:"surname,omitempty"`
	Nationality  string     `json:"nationality,omitempty"`
	PlaceOfBirth string     `json:"place_of_birth,omitempty"`
	DateOfBirth  string     `json:"date_of_birth,omitempty"`
	Gender       string     `json:"gender,omitempty"`
	Employment   Employment `json:"employment,omitempty" gorm:"embedded;embeddedPrefix:emp_"`
}

type InitializedLinkedAccount

type InitializedLinkedAccount struct {
	ID            string                 `json:"id"`
	CustomerID    string                 `json:"customer_id"`
	ChannelCode   ChannelCodeEnum        `json:"channel_code"`
	AuthorizerURL string                 `json:"authorizer_url,omitempty"`
	Status        string                 `json:"status,omitempty"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

InitializedLinkedAccount contains data from Xendit's API response of initialize linked account related requests. For more details see https://xendit.github.io/apireference/?bash#initialize-linked-account-tokenization. For documentation of subpackage linked account, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebit/linkedaccount/

type Invoice

type Invoice struct {
	ID                             string                                `json:"id"`
	InvoiceURL                     string                                `json:"invoice_url"`
	UserID                         string                                `json:"user_id,omitempty"`
	ExternalID                     string                                `json:"external_id"`
	Status                         string                                `json:"status"`
	MerchantName                   string                                `json:"merchant_name"`
	MerchantProfilePictureURL      string                                `json:"merchant_profile_picture_url,omitempty"`
	Amount                         float64                               `json:"amount"`
	Locale                         string                                `json:"locale,omitempty"`
	Items                          []InvoiceItem                         `json:"items,omitempty"`
	Fees                           []InvoiceFee                          `json:"fees,omitempty"`
	PayerEmail                     string                                `json:"payer_email,omitempty"`
	Description                    string                                `json:"description,omitempty"`
	ExpiryDate                     *time.Time                            `json:"expiry_date"`
	Customer                       InvoiceCustomer                       `json:"customer,omitempty"`
	CustomerNotificationPreference InvoiceCustomerNotificationPreference `json:"customer_notification_preference,omitempty"`
	AvailableBanks                 []InvoiceBank                         `json:"available_banks,omitempty"`
	AvailableEWallets              []InvoiceEWallet                      `json:"available_ewallets,omitempty"`
	AvailableRetailOutlets         []InvoiceRetailOutlet                 `json:"available_retail_outlets,omitempty"`
	ReminderDate                   *time.Time                            `json:"reminder_date,omitempty"`
	FixedVA                        bool                                  `json:"fixed_va,omitempty"`
	MidLabel                       string                                `json:"mid_label,omitempty"`
	ShouldExcludeCreditCard        bool                                  `json:"should_exclude_credit_card,omitempty"`
	ShouldAuthenticateCreditCard   bool                                  `json:"should_authenticate_credit_card,omitempty"`
	ShouldSendEmail                bool                                  `json:"should_send_email"`
	Created                        *time.Time                            `json:"created"`
	Updated                        *time.Time                            `json:"updated"`
	Currency                       string                                `json:"currency,omitempty"`
	PaidAt                         *time.Time                            `json:"paid_at,omitempty"`
	PaymentMethod                  string                                `json:"payment_method,omitempty"`
	PaymentChannel                 string                                `json:"payment_channel,omitempty"`
	PaymentDestination             string                                `json:"payment_destination,omitempty"`
	PaymentDetail                  InvoicePaymentDetail                  `json:"payment_details,omitempty"`
	SuccessRedirectURL             string                                `json:"success_redirect_url,omitempty"`
	FailureRedirectURL             string                                `json:"failure_redirect_url,omitempty"`
	RecurringPaymentID             string                                `json:"recurring_payment_id,omitempty"`
	CreditCardChargeID             string                                `json:"credit_card_charge_id,omitempty"`
	AdjustedReceivedAmount         float64                               `json:"adjusted_received_amount,omitempty"`
	//deprecated
	BankCode   string  `json:"bank_code,omitempty"`
	PaidAmount float64 `json:"paid_amount,omitempty"`
}

Invoice contains data from Xendit's API response of invoice related requests. For more API details see https://xendit.github.io/apireference/?bash#invoices. For documentation of subpackage invoice, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/invoice

type InvoiceBank

type InvoiceBank 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    int     `json:"identity_amount"`
}

InvoiceBank is data that contained in `Invoice` at AvailableBanks

type InvoiceCustomer

type InvoiceCustomer struct {
	GivenNames   string                   `json:"given_names,omitempty"`
	Surname      string                   `json:"surname,omitempty"`
	Email        string                   `json:"email,omitempty"`
	MobileNumber string                   `json:"mobile_number,omitempty"`
	Address      []InvoiceCustomerAddress `json:"addresses,omitempty"`
}

InvoiceCustomer is data that contained in `Invoice` at Customer

type InvoiceCustomerAddress

type InvoiceCustomerAddress struct {
	City        string `json:"city,omitempty"`
	Country     string `json:"country,omitempty"`
	PostalCode  string `json:"postal_code,omitempty"`
	State       string `json:"state,omitempty"`
	StreetLine1 string `json:"street_line1,omitempty"`
	StreetLine2 string `json:"street_line2,omitempty"`
}

type InvoiceCustomerNotificationPreference

type InvoiceCustomerNotificationPreference struct {
	InvoiceCreated  []string `json:"invoice_created,omitempty"`
	InvoiceReminder []string `json:"invoice_reminder,omitempty"`
	InvoicePaid     []string `json:"invoice_paid,omitempty"`
	InvoiceExpired  []string `json:"invoice_expired,omitempty"`
}

InvoiceCustomerNotificationPreference is data that contained in `Invoice` at CustomerNotificationPreference

type InvoiceEWallet

type InvoiceEWallet struct {
	EWalletType string `json:"ewallet_type"`
}

InvoiceEWallet is data that contained in `Invoice` at AvailableEWallets

type InvoiceFee

type InvoiceFee struct {
	Type  string  `json:"type" validate:"required"`
	Value float64 `json:"value" validate:"required"`
}

InvoiceFee is data that contained in `Invoice` at Fees

type InvoiceItem

type InvoiceItem struct {
	Name     string  `json:"name" validate:"required"`
	Price    float64 `json:"price" validate:"required"`
	Quantity int     `json:"quantity" validate:"required"`
	Category string  `json:"category,omitempty"`
	Url      string  `json:"url,omitempty"`
}

InvoiceItem is data that contained in `Invoice` at Items

type InvoicePaymentDetail

type InvoicePaymentDetail struct {
	ReceiptID string `json:"receipt_id,omitempty"`
	Source    string `json:"source,omitempty"`
}

InvoicePaymentDetail is data that contained in `Invoice` at PaymentDetail

type InvoiceRetailOutlet

type InvoiceRetailOutlet struct {
	RetailOutletName string `json:"retail_outlet_name"`
	//WILL BE DEPRECATED SOON
	PaymentCode string `json:"payment_code,omitempty"`
	//WILL BE DEPRECATED SOON
	TransferAmount float64 `json:"transfer_amount,omitempty"`
	MerchantName   string  `json:"merchant_name,omitempty"`
}

InvoiceRetailOutlet is data that contained in `Invoice` at AvailableRetailOutlets

type ListTransactions

type ListTransactions struct {
	Data    []Transaction           `json:"data"`
	HasMore bool                    `json:"has_more"`
	Links   []ListTransactionsLinks `json:"links"`
}
type ListTransactionsLinks struct {
	Href   string `json:"href"`
	Rel    string `json:"rel"`
	Method string `json:"method"`
}

ListTransactionsLinks is data that contained in `ListTransactions` at Links field.

type MissedPaymentActionEnum

type MissedPaymentActionEnum string

MissedPaymentActionEnum constants are the available recurring payment missed payment actions

const (
	MissedPaymentActionIgnore MissedPaymentActionEnum = "IGNORE"
	MissedPaymentActionStop   MissedPaymentActionEnum = "STOP"
)

This consists the values that MissedPaymentActionEnum can take

type Option

type Option struct {
	SecretKey string // customer's secret API key
	XenditURL string // should there be a need to override API base URL
}

Option is the wrap of the parameters needed for the API call

var Opt Option = Option{
	XenditURL: "https://api.xendit.co",
}

Opt is the default Option for the API call without API client

type OverTheCounter

type OverTheCounter struct {
	ChannelCode       string            `json:"channel_code"`
	Currency          string            `json:"currency"`
	Amount            float64           `json:"amount,omitempty"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
}

type Payment

type Payment struct {
	ID                string            `json:"id"`
	PaymentRequestID  string            `json:"payment_request_id,omitempty"`
	ReferenceID       string            `json:"reference_id"`
	CustomerID        string            `json:"customer_id,omitempty"`
	Currency          string            `json:"currency"`
	Amount            float64           `json:"amount"`
	Country           string            `json:"country"`
	Status            string            `json:"status"`
	PaymentMethod     PaymentMethod2    `json:"payment_method" gorm:"embedded;embeddedPrefix:pm_"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
	PaymentDetail     PaymentDetail     `json:"payment_detail" gorm:"embedded;embeddedPrefix:pd_"`
	FailureCode       string            `json:"failure_code,omitempty"`
	Created           string            `json:"created"`
	Updated           string            `json:"updated"`
	Metadata          datatypes.JSONMap `json:"metadata,omitempty"`
}

type PaymentDetail

type PaymentDetail struct {
	Remarks string `json:"remarks"`
}

type PaymentMethod

type PaymentMethod struct {
	ID         string                 `json:"id"`
	Type       AccountTypeEnum        `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	CustomerID string                 `json:"customer_id"`
	Status     string                 `json:"status"`
	Created    string                 `json:"created"`
	Updated    string                 `json:"updated"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

PaymentMethod contains data from Xendit's API response of payment method related requests. For more details see https://xendit.github.io/apireference/?bash#create-payment-method. For documentation of subpackage payment method, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebit/paymentmethod/

type PaymentMethod2

type PaymentMethod2 struct {
	ID                 string             `json:"id"`
	BusinessID         string             `json:"business_id"`
	CustomerID         string             `json:"customer_id,omitempty"`
	ReferenceID        string             `json:"reference_id,omitempty"`
	Reusability        string             `json:"reusability"`
	Country            string             `json:"country"`
	Status             string             `json:"status"`
	Actions            []Actions2         `json:"actions,omitempty" gorm:"foreignKey:ReferenceID;references:ReferenceID"`
	PaymentRequestID   string             `json:"payment_request_id"`
	Currency           string             `json:"currency"`
	Amount             float64            `json:"amount"`
	Type               string             `json:"type"`
	Ewallet            Ewallet            `json:"ewallet,omitempty" gorm:"embedded;embeddedPrefix:ew_"`
	DirectDebit        DirectDebit        `json:"direct_debit,omitempty" gorm:"embedded;embeddedPrefix:dd_"`
	Card               Card               `json:"card,omitempty" gorm:"embedded;embeddedPrefix:cc_"`
	OverTheCounter     OverTheCounter     `json:"over_the_counter,omitempty" gorm:"embedded;embeddedPrefix:otc_"`
	VirtualAccount     VirtualAccount2    `json:"virtual_account,omitempty" gorm:"embedded;embeddedPrefix:va_"`
	QrCode             QrCode             `json:"qr_code,omitempty" gorm:"embedded;embeddedPrefix:qr_"`
	Description        string             `json:"description,omitempty"`
	BillingInformation BillingInformation `json:"billing_information,omitempty" gorm:"embedded;embeddedPrefix:bi_"`
	Created            string             `json:"created"`
	Updated            string             `json:"updated"`
	Metadata           datatypes.JSONMap  `json:"metadata,omitempty"`
}

type PaymentRequest

type PaymentRequest struct {
	ID                      string                  `json:"id"`
	BusinessID              string                  `json:"business_id"`
	CustomerID              string                  `json:"customer_id,omitempty"`
	ReferenceID             string                  `json:"reference_id,omitempty"`
	Currency                string                  `json:"currency"`
	Amount                  float64                 `json:"amount"`
	CaptureAmount           float64                 `json:"capture_amount"`
	Country                 string                  `json:"country"`
	Status                  string                  `json:"status"`
	Description             string                  `json:"description,omitempty"`
	PaymentMethod           PaymentMethod2          `json:"payment_method" gorm:"embedded;embeddedPrefix:pm_"`
	Actions                 []Actions2              `json:"actions,omitempty" gorm:"foreignKey:ReferenceID;references:ReferenceID"`
	CaptureMethod           string                  `json:"capture_method"`
	Initiator               string                  `json:"initiator"`
	ChannelProperties       ChannelProperties       `json:"channel_properties,omitempty" gorm:"embedded;embeddedPrefix:cpros_"`
	ShippingInformation     ShippingInformation2    `json:"shipping_information,omitempty" gorm:"embedded;embeddedPrefix:si_"`
	CardVerificationResults CardVerificationResults `json:"card_verification_results,omitempty" gorm:"embedded;embeddedPrefix:cvr_"`
	FailureCode             string                  `json:"failure_code"`
	Created                 string                  `json:"created"`
	Updated                 string                  `json:"updated"`
	Metadata                datatypes.JSONMap       `json:"metadata,omitempty"`
}

type PaymentTypeEnum

type PaymentTypeEnum string

PaymentTypeEnum constants are the available payment types

const (
	PaymentTypeEnum30Days   PaymentTypeEnum = "30_days"
	PaymentTypeEnum3Months  PaymentTypeEnum = "3_months"
	PaymentTypeEnum6Months  PaymentTypeEnum = "6_months"
	PaymentTypeEnum12Months PaymentTypeEnum = "12_months"
)

This consists the values that PaymentTypeEnum can take

type Payout

type Payout struct {
	ID                  string     `json:"id"`
	ExternalID          string     `json:"external_id"`
	Amount              float64    `json:"amount"`
	Status              string     `json:"status"`
	Email               string     `json:"email,omitempty"`
	PaymentID           string     `json:"payment_id,omitempty"`
	BankCode            string     `json:"bank_code,omitempty"`
	AccountHolderName   string     `json:"account_holder_name,omitempty"`
	AccountNumber       string     `json:"account_number,omitempty"`
	DisbursementID      string     `json:"disbursement_id,omitempty"`
	FailureReason       string     `json:"failure_reason,omitempty"`
	Created             *time.Time `json:"created,omitempty"`
	ExpirationTimestamp *time.Time `json:"expiration_timestamp,omitempty"`
	ClaimedTimestamp    *time.Time `json:"claimed_timestamp,omitempty"`
	FailedTimestamp     *time.Time `json:"failed_timestamp,omitempty"`
	MerchantName        string     `json:"merchant_name,omitempty"`
	PayoutURL           string     `json:"payout_url,omitempty"`
}

Payout contains data from Xendit's API response of invoice related request. For more details see https://xendit.github.io/apireference/?bash#payouts. For documentation of subpackage payout, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/payout

type Promotion

type Promotion struct {
	ID                string     `json:"id"`
	BusinessID        string     `json:"business_id"`
	Status            string     `json:"status"`
	ReferenceID       string     `json:"reference_id"`
	Description       string     `json:"description"`
	PromoCode         string     `json:"promo_code"`
	BinList           []string   `json:"bin_list"`
	ChannelCode       string     `json:"channel_code"`
	DiscountPercent   float64    `json:"discount_percent"`
	DiscountAmount    float64    `json:"discount_amount"`
	Currency          string     `json:"currency"`
	StartTime         *time.Time `json:"start_time"`
	EndTime           *time.Time `json:"end_time"`
	MinOriginalAmount float64    `json:"min_original_amount"`
	MaxDiscountAmount float64    `json:"max_discount_amount"`
}

Promotion contains data from Xendit's API response of promotion-related request. For more details see https://xendit.github.io/apireference/?bash#create-promotion.

type PromotionDeletion

type PromotionDeletion struct {
	ID        string `json:"id"`
	IsDeleted bool   `json:"is_deleted"`
}

PromotionDeletion contains data from Xendit's API response of delete promotion request. For more details see https://xendit.github.io/apireference/?bash#create-promotion.

type PublicProfile

type PublicProfile struct {
	BusinessName string `json:"business_name,omitempty"`
}

type QRCode

type QRCode struct {
	ID          string     `json:"id"`
	ExternalID  string     `json:"external_id"`
	Amount      float64    `json:"amount"`
	QRString    string     `json:"qr_string"`
	CallbackURL string     `json:"callback_url"`
	Type        QRCodeType `json:"type"`
	Status      string     `json:"status"`
	Created     *time.Time `json:"created"`
	Updated     *time.Time `json:"updated"`
}

QRCode contains data from Xendit's API response of QR code related request. For more details see https://developers.xendit.co/api-reference/#create-qr-code

type QRCodePayments

type QRCodePayments struct {
	ID      string     `json:"id"`
	Amount  float64    `json:"amount"`
	Created *time.Time `json:"created"`
	Status  string     `json:"status"`
	QRCode  QRDetail   `json:"qr_code"`
}

QRCodePayments contains data from Xendit's API response of QRCode payments related request. For more details see https://developers.xendit.co/api-reference/#get-payments-by-external-id

type QRCodeType

type QRCodeType string

QRCodeType constants are the available QR Code type

const (
	DynamicQRCode QRCodeType = "DYNAMIC"
	StaticQRCode  QRCodeType = "STATIC"
)

This consists the values that QRCodeType can have

type QRDetail

type QRDetail struct {
	ID         string     `json:"id"`
	ExternalID string     `json:"external_id"`
	QRString   string     `json:"qr_string"`
	Type       QRCodeType `json:"type"`
}

QRDetail contains data from qr field from Xendit's API response of QRCode payments related request For more details see https://developers.xendit.co/api-reference/#get-payments-by-external-id

type QrCode

type QrCode struct {
	ChannelCode       string            `json:"channel_code"`
	Currency          string            `json:"currency"`
	Amount            float64           `json:"amount,omitempty"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
}

type ReceiptNotification

type ReceiptNotification struct {
	EmailTo  pq.StringArray `json:"email_to,omitempty" gorm:"type:text[]"`
	EmailCC  pq.StringArray `json:"email_cc,omitempty" gorm:"type:text[]"`
	EmailBCC pq.StringArray `json:"email_bcc,omitempty" gorm:"type:text[]"`
}

ReceiptNotification is data that contained in Create at ReceiptNotification

type RecurringPaymenCustomerAddress

type RecurringPaymenCustomerAddress struct {
	City        string `json:"city,omitempty"`
	Country     string `json:"country,omitempty"`
	PostalCode  string `json:"postal_code,omitempty"`
	State       string `json:"state,omitempty"`
	StreetLine1 string `json:"street_line1,omitempty"`
	StreetLine2 string `json:"street_line2,omitempty"`
}

RecurringPaymenCustomerAddress is data that contained in `RecurringPaymentCustomer` at Address

type RecurringPayment

type RecurringPayment struct {
	ID                             string                         `json:"id"`
	ExternalID                     string                         `json:"external_id"`
	UserID                         string                         `json:"user_id"`
	PayerEmail                     string                         `json:"payer_email"`
	Description                    string                         `json:"description"`
	Status                         string                         `json:"status"`
	Amount                         float64                        `json:"amount"`
	ShouldSendEmail                bool                           `json:"should_send_email"`
	Customer                       RecurringPaymentCustomer       `json:"customer,omitempty"`
	CustomerNotificationPreference CustomerNotificationPreference `json:"customer_notification_preference,omitempty"`
	Interval                       RecurringPaymentIntervalEnum   `json:"interval"`
	IntervalCount                  int                            `json:"interval_count"`
	MissedPaymentAction            MissedPaymentActionEnum        `json:"missed_payment_action"`
	Created                        *time.Time                     `json:"created"`
	Updated                        *time.Time                     `json:"updated"`
	InvoiceDuration                int                            `json:"invoice_duration,omitempty"`
	StartDate                      *time.Time                     `json:"start_date,omitempty"`
	LastCreatedInvoiceURL          string                         `json:"last_created_invoice_url,omitempty"`
	CreditCardToken                string                         `json:"credit_card_token,omitempty"`
	SuccessRedirectURL             string                         `json:"success_redirect_url,omitempty"`
	FailureRedirectURL             string                         `json:"failure_redirect_url,omitempty"`
	TotalRecurrence                int                            `json:"total_recurrence,omitempty"`
	RecurrenceProgress             int                            `json:"recurrence_progress,omitempty"`
	Recharge                       bool                           `json:"recharge,omitempty"`
	ChargeImmediately              bool                           `json:"charge_immediately,omitempty"`
	Currency                       string                         `json:"currency,omitempty"`
}

RecurringPayment contains data from Xendit's API response of recurring payment related requests. For more details see https://xendit.github.io/apireference/?bash#recurring-payments. For documentation of subpackage recurringpayment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/recurringpayment

type RecurringPaymentCustomer

type RecurringPaymentCustomer struct {
	GivenNames   string                           `json:"given_names,omitempty"`
	Email        string                           `json:"email,omitempty"`
	MobileNumber string                           `json:"mobile_number,omitempty"`
	Address      []RecurringPaymenCustomerAddress `json:"address,omitempty"`
}

RecurringPaymentCustomer is data that contained in `RecurringPayment` at Customer

type RecurringPaymentIntervalEnum

type RecurringPaymentIntervalEnum string

RecurringPaymentIntervalEnum constants are the available recurring payment intervals

const (
	RecurringPaymentIntervalDay   RecurringPaymentIntervalEnum = "DAY"
	RecurringPaymentIntervalWeek  RecurringPaymentIntervalEnum = "WEEK"
	RecurringPaymentIntervalMonth RecurringPaymentIntervalEnum = "MONTH"
)

This consists the values that RecurringPaymentIntervalEnum can take

type Refund

type Refund struct {
	ID                string  `json:"id"`
	PaymentRequestID  string  `json:"payment_request_id"`
	InvoiceID         string  `json:"invoice_id"`
	PaymentMethodType string  `json:"payment_method_type"`
	ReferenceID       string  `json:"reference_id"`
	Status            string  `json:"status"`
	Country           string  `json:"country"`
	ChannelCode       string  `json:"channel_code"`
	Reason            string  `json:"reason"`
	FailureCode       string  `json:"failure_code"`
	RefundFeeAmount   float64 `json:"refund_fee_amount"`
	Created           string  `json:"created"`
	Updated           string  `json:"updated"`
	Metadata          string  `json:"metadata,omitempty"`
}

type RetailOutlet

type RetailOutlet struct {
	IsSingleUse      bool                 `json:"is_single_use"`
	Status           string               `json:"status"`
	OwnerID          string               `json:"owner_id"`
	ExternalID       string               `json:"external_id"`
	RetailOutletName RetailOutletNameEnum `json:"retail_outlet_name"`
	Prefix           string               `json:"prefix"`
	Name             string               `json:"name"`
	PaymentCode      string               `json:"payment_code"`
	Type             string               `json:"type"`
	ExpectedAmount   float64              `json:"expected_amount"`
	ExpirationDate   *time.Time           `json:"expiration_date"`
	ID               string               `json:"id"`
}

RetailOutlet contains data from Xendit's API response of retail outlet related requests. For more details see https://xendit.github.io/apireference/?bash#retail-outlets. For documentation of subpackage retailoutlet, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/retailoutlet

type RetailOutletNameEnum

type RetailOutletNameEnum string

RetailOutletNameEnum constants are the available retail outlet names

const (
	RetailOutletNameAlfamart  RetailOutletNameEnum = "ALFAMART"
	RetailOutletNameIndomaret RetailOutletNameEnum = "INDOMARET"
)

This consists the values that RetailOutletNameEnum can take

type RetailOutletPayment

type RetailOutletPayment struct {
	ID                        string               `json:"id"`
	FixedPaymentCodeID        string               `json:"fixed_payment_code_id"`
	FixedPaymentCodePaymentID string               `json:"fixed_payment_code_payment_id"`
	PaymentCode               string               `json:"payment_code"`
	RetailOutletName          RetailOutletNameEnum `json:"retail_outlet_name"`
	Amount                    float64              `json:"amount"`
	Status                    string               `json:"status"`
	OwnerID                   string               `json:"owner_id"`
	Name                      string               `json:"name"`
	Prefix                    string               `json:"prefix"`
	PaymentID                 string               `json:"payment_id"`
	ExternalID                string               `json:"external_id"`
	TransactionTimestamp      *time.Time           `json:"transaction_timestamp"`
}

type RetailOutletPayments

type RetailOutletPayments struct {
	Data    []RetailOutletPayment     `json:"data"`
	HasMore bool                      `json:"has_more"`
	Links   RetailOutletPaymentsLinks `json:"links"`
}

RetailOutletPayments contains data from Xendit's API response of Retail Outlet Get Payments By Fixed Payment Code ID requests. For more details see https://developers.xendit.co/api-reference/#get-payments-by-fixed-payment-code-id. For documentation of subpackage direct debit payment, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/retailoutlet/

type RetailOutletPaymentsLinks struct {
	Href   string `json:"href"`
	Rel    string `json:"rel"`
	Method string `json:"method"`
}

RetailOutletPaymentsLinks is data that contained in `RetailOutletPayments` at Links field.

type ShippingInformation

type ShippingInformation struct {
	Country       string  `json:"country"` //two letter country code eg. ID/PH
	StreetLine1   string  `json:"street_line1"`
	StreetLine2   *string `json:"street_line2,omitempty"`
	City          string  `json:"city"`
	ProvinceState string  `json:"province_state"`
	PostalCode    string  `json:"postal_code"`
}

ShippingInformation struct for Ewallet Charge ShippingInformation

type ShippingInformation2

type ShippingInformation2 struct {
	Country       string `json:"country,omitempty"`
	StreetLine1   string `json:"street_line1,omitempty"`
	StreetLine2   string `json:"street_line2,omitempty"`
	City          string `json:"city,omitempty"`
	ProvinceState string `json:"province_state,omitempty"`
	PostalCode    string `json:"postal_code,omitempty"`
}

type Status

type Status string
const (
	LIVE          Status = "LIVE"
	AWAITING_DOCS Status = "AWAITING_DOCS"
	REGISTERED    Status = "REGISTERED"
	INVITED       Status = "INVITED"
)

type ThreeDSecure

type ThreeDSecure struct {
	ThreeDSecureFlow    string `json:"three_d_Secure_flow,omitempty"`
	EciCode             string `json:"eci_code,omitempty"`
	ThreeDSecureResult  string `json:"three_d_secure_result,omitempty"`
	ThreeDSecureVersion string `json:"three_d_secure_version,omitempty"`
}

type Transaction

type Transaction struct {
	ID                string         `json:"id"`
	ProductID         string         `json:"product_id"`
	Type              string         `json:"type"`
	ChannelCode       string         `json:"channel_code,omitempty"`
	ReferenceID       string         `json:"reference_id"`
	AccountIdentifier string         `json:"account_identifier,omitempty"`
	Currency          string         `json:"currency,omitempty"`
	Amount            float64        `json:"amount"`
	NetAmount         float64        `json:"net_amount"`
	Cashflow          string         `json:"cashflow"`
	Status            string         `json:"status"`
	ChannelCategory   string         `json:"channel_category"`
	BusinessID        string         `json:"business_id"`
	Created           *time.Time     `json:"created"`
	Updated           *time.Time     `json:"updated"`
	Fee               TransactionFee `json:"fee"`
}

Transaction contains data from Xendit's API response of invoice related request. For more details see https://developers.xendit.co/api-reference/#transactions. For documentation of subpackage payout, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/transaction

type TransactionFee

type TransactionFee struct {
	XenditFee                float64 `json:"xendit_fee,omitempty"`
	ValueAddedTax            float64 `json:"value_added_tax,omitempty"`
	XenditWithholdingTax     float64 `json:"xendit_withholding_tax,omitempty"`
	ThirdPartyWithholdingTax float64 `json:"third_party_withholding_tax,omitempty"`
	Status                   string  `json:"status,omitempty"`
}

type UnbindedLinkedAccount

type UnbindedLinkedAccount struct {
	ID        string `json:"id"`
	IsDeleted bool   `json:"is_deleted"`
}

UnbindedLinkedAccount contains data from Xendit's API response of unbind linked account token related requests. For more details see https://xendit.github.io/apireference/?bash#unbind-a-linked-account-token. For documentation of subpackage linked account, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebit/linkedaccount/

type ValidatedLinkedAccount

type ValidatedLinkedAccount struct {
	ID          string          `json:"id"`
	CustomerID  string          `json:"customer_id"`
	ChannelCode ChannelCodeEnum `json:"channel_code"`
	Status      string          `json:"status"`
}

ValidatedLinkedAccount contains data from Xendit's API response of validate linked account related requests. For more details see https://xendit.github.io/apireference/?bash#validate-otp-for-linked-account-token. For documentation of subpackage linked account, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/directdebit/linkedaccount/

type VirtualAccount

type VirtualAccount struct {
	OwnerID         string     `json:"owner_id"`
	ExternalID      string     `json:"external_id"`
	BankCode        string     `json:"bank_code"`
	MerchantCode    string     `json:"merchant_code"`
	Name            string     `json:"name"`
	AccountNumber   string     `json:"account_number"`
	IsClosed        *bool      `json:"is_closed"`
	ID              string     `json:"id"`
	IsSingleUse     *bool      `json:"is_single_use"`
	Status          string     `json:"status"`
	Currency        string     `json:"currency"`
	ExpirationDate  *time.Time `json:"expiration_date"`
	SuggestedAmount float64    `json:"suggested_amount,omitempty"`
	ExpectedAmount  float64    `json:"expected_amount,omitempty"`
	Description     string     `json:"description,omitempty"`
}

VirtualAccount contains data from Xendit's API response of virtual account related requests. For more details see https://xendit.github.io/apireference/?bash#virtual-accounts. For documentation of subpackage virtualaccount, checkout https://pkg.go.dev/github.com/ianeinser/xendit-go/virtualaccount

type VirtualAccount2

type VirtualAccount2 struct {
	ChannelCode       string            `json:"channel_code"`
	Currency          string            `json:"currency"`
	Amount            float64           `json:"amount,omitempty"`
	ChannelProperties ChannelProperties `json:"channel_properties" gorm:"embedded;embeddedPrefix:cpros_"`
}

type VirtualAccountBank

type VirtualAccountBank struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

VirtualAccountBank contains data from Xendit's API response of Get Virtual Account Banks.

type VirtualAccountPayment

type VirtualAccountPayment struct {
	ID                       string     `json:"id"`
	PaymentID                string     `json:"payment_id"`
	CallbackVirtualAccountID string     `json:"callback_virtual_account_id"`
	ExternalID               string     `json:"external_id"`
	AccountNumber            string     `json:"account_number"`
	BankCode                 string     `json:"bank_code"`
	Amount                   float64    `json:"amount"`
	TransactionTimestamp     *time.Time `json:"transaction_timestamp"`
	MerchantCode             string     `json:"merchant_code"`
	Currency                 string     `json:"currency"`
	SenderName               string     `json:"sender_name"`
}

VirtualAccountPayment contains data from Xendit's API response of Get Fixed Virtual Account Payment.

Directories

Path Synopsis
Package client provides a Xendit client for invoking APIs across all products
Package client provides a Xendit client for invoking APIs across all products
directdebit
example
utils

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL