payment

package
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: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePaymentMethod

func CreatePaymentMethod(data *map[string]interface{}) (*xendit.PaymentMethod2, *xendit.Error)

CreatePaymentMethod creates new payment method for user

Example
xendit.Opt.SecretKey = "examplesecretkey"

billingInformation := xendit.BillingInformation{
	Country:       "ID",
	StreetLine1:   "Jl. 123",
	StreetLine2:   "Jl. 456",
	City:          "Jakarta Selatan",
	ProvinceState: "DKI Jakarta",
	PostalCode:    "12345",
}

metadata := map[string]interface{}{
	"meta": "data",
}

data := payment.CreatePaymentMethodParams{
	Type:               "",
	Reusability:        "",
	ReferenceID:        "",
	CustomerID:         "",
	Country:            "",
	Description:        "",
	BillingInformation: billingInformation,
	Metadata:           metadata,
}

resp, err := payment.CreatePaymentMethod(&data)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("created payment method: %+v\n", resp)
Output:

func CreatePaymentMethodWithContext

func CreatePaymentMethodWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.PaymentMethod2, *xendit.Error)

CreatePaymentMethodWithContext creates new payment

func CreatePaymentRequest

func CreatePaymentRequest(data *map[string]interface{}) (*xendit.PaymentRequest, *xendit.Error)

CreatePaymentRequest provides the following functionalities: 1. Initializes the payment/capture process for Cards, E-wallets and Direct Debits 2. Creates a payment method object along with the payment initialization

func CreatePaymentRequestWithContext

func CreatePaymentRequestWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.PaymentRequest, *xendit.Error)

CreatePaymentRequestWithContext provides the following functionalities: 1. Initializes the payment/capture process for Cards, E-wallets and Direct Debits 2. Creates a payment method object along with the payment initialization

func CreateRefund

func CreateRefund(data *map[string]interface{}) (*xendit.Refund, *xendit.Error)

CreateRefund initialized the refund process for the provided amount for a given successful payment

func CreateRefundWithContext

func CreateRefundWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.Refund, *xendit.Error)

CreateRefundWithContext initialized the refund process for the provided amount for a given successful payment

func GenerateIdempotencyKey added in v1.0.48

func GenerateIdempotencyKey() string

func GetPaymentMethodById added in v1.0.10

func GetPaymentMethodById(data *GetPaymentMethodByIdParams) (*xendit.PaymentMethod2, *xendit.Error)

GetPaymentMethodById returns the corresponding Payment Method that matches the provided ID.

func GetPaymentMethodByIdWithContext added in v1.0.10

func GetPaymentMethodByIdWithContext(ctx context.Context, data *GetPaymentMethodByIdParams) (*xendit.PaymentMethod2, *xendit.Error)

GetPaymentMethodByIdWithContext returns the corresponding Payment Method that matches the provided ID.

func GetPaymentRequestById

func GetPaymentRequestById(data *GetPaymentRequestByIdParams) (*xendit.PaymentRequest, *xendit.Error)

GetPaymentRequestById returns the corresponding Payment Method that matches the provided ID

func GetPaymentRequestByIdWithContext

func GetPaymentRequestByIdWithContext(ctx context.Context, data *GetPaymentRequestByIdParams) (*xendit.PaymentRequest, *xendit.Error)

GetPaymentRequestByIdWithContext returns the corresponding Payment Method that matches the provided ID

func GetRefundById

func GetRefundById(data *GetRefundByIdParams) (*xendit.Refund, *xendit.Error)

GetRefundbyId returns the corresponding Refund that matches the provided ID

func GetRefundByIdWithContext

func GetRefundByIdWithContext(ctx context.Context, data *GetRefundByIdParams) (*xendit.Refund, *xendit.Error)

GetRefundbyIdWithContext returns the corresponding Refund that matches the provided ID

Types

type Client

type Client struct {
	Opt          *xendit.Option
	APIRequester xendit.APIRequester
}

func (*Client) CreatePaymentMethod

func (c *Client) CreatePaymentMethod(data *map[string]interface{}) (*xendit.PaymentMethod2, *xendit.Error)

CreatePaymentMethod creates new payment method for user

func (*Client) CreatePaymentMethodWithContext

func (c *Client) CreatePaymentMethodWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.PaymentMethod2, *xendit.Error)

CreatePaymentMethodWithContext creates new payment method for user

func (*Client) CreatePaymentRequest

func (c *Client) CreatePaymentRequest(data *map[string]interface{}) (*xendit.PaymentRequest, *xendit.Error)

CreatePaymentRequest provides the following functionalities: 1. Initializes the payment/capture process for Cards, E-wallets and Direct Debits 2. Creates a payment method object along with the payment initialization

func (*Client) CreatePaymentRequestWithContext

func (c *Client) CreatePaymentRequestWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.PaymentRequest, *xendit.Error)

CreatePaymentMethodWithContext provides the following functionalities: 1. Initializes the payment/capture process for Cards, E-wallets and Direct Debits 2. Creates a payment method object along with the payment initialization

func (*Client) CreateRefund

func (c *Client) CreateRefund(data *map[string]interface{}) (*xendit.Refund, *xendit.Error)

CreateRefund initialized the refund process for the provided amount for a given successful payment

func (*Client) CreateRefundWithContext

func (c *Client) CreateRefundWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.Refund, *xendit.Error)

CreateRefundWithContext initialized the refund process for the provided amount for a given successful payment

func (*Client) GetPaymentMethodById added in v1.0.10

func (c *Client) GetPaymentMethodById(data *GetPaymentMethodByIdParams) (*xendit.PaymentMethod2, *xendit.Error)

GetPaymentMethodById returns the corresponding Payment Method that matches the provided ID.

func (*Client) GetPaymentMethodByIdWithContext added in v1.0.10

func (c *Client) GetPaymentMethodByIdWithContext(ctx context.Context, data *GetPaymentMethodByIdParams) (*xendit.PaymentMethod2, *xendit.Error)

GetPaymentMethodByIdWithContext returns the corresponding Payment Method that matches the provided ID.

func (*Client) GetPaymentRequestById

func (c *Client) GetPaymentRequestById(data *GetPaymentRequestByIdParams) (*xendit.PaymentRequest, *xendit.Error)

GetPaymentRequestById returns the corresponding Payment Method that matches the provided ID

func (*Client) GetPaymentRequestByIdWithContext

func (c *Client) GetPaymentRequestByIdWithContext(ctx context.Context, data *GetPaymentRequestByIdParams) (*xendit.PaymentRequest, *xendit.Error)

GetPaymentRequestByIdWithContext returns the corresponding Payment Method that matches the provided ID.

func (*Client) GetRefundById

func (c *Client) GetRefundById(data *GetRefundByIdParams) (*xendit.Refund, *xendit.Error)

GetRefundbyId returns the corresponding Refund that matches the provided ID

func (*Client) GetRefundByIdWithContext

func (c *Client) GetRefundByIdWithContext(ctx context.Context, data *GetRefundByIdParams) (*xendit.Refund, *xendit.Error)

GetRefundbyIdWithContext returns the corresponding Refund that matches the provided ID

func (*Client) ListPaymentMethods

func (c *Client) ListPaymentMethods(data *ListPaymentMethodsParams) (*ListPaymentMethodsResponse, *xendit.Error)

ListPaymentMethods returns a list of matching Payment Method objects based on the provided query

func (*Client) ListPaymentMethodsWithContext

func (c *Client) ListPaymentMethodsWithContext(ctx context.Context, data *ListPaymentMethodsParams) (*ListPaymentMethodsResponse, *xendit.Error)

ListPaymentMethodsWithContext returns a list of matching Payment Method objects based on the provided query

func (*Client) ListPaymentRequests

func (c *Client) ListPaymentRequests(data *ListPaymentRequestsParams) (*ListPaymentRequestsResponse, *xendit.Error)

ListPaymentRequests returns a list of matching Payment Request objects based on the provided query.

func (*Client) ListPaymentRequestsWithContext

func (c *Client) ListPaymentRequestsWithContext(ctx context.Context, data *ListPaymentRequestsParams) (*ListPaymentRequestsResponse, *xendit.Error)

ListPaymentRequestsWithContext returns a list of matching Payment Request objects based on the provided query.

func (*Client) ListPaymentsByPaymentMethodId

func (c *Client) ListPaymentsByPaymentMethodId(data *ListPaymentsByPaymentMethodIdParams) (*ListPaymentsByPaymentMethodIdResponse, *xendit.Error)

ListPaymentsByPayentMethodId returns a list of matching Payment objects made on a Payment Method

func (*Client) ListPaymentsByPaymentMethodIdWithContext

func (c *Client) ListPaymentsByPaymentMethodIdWithContext(ctx context.Context, data *ListPaymentsByPaymentMethodIdParams) (*ListPaymentsByPaymentMethodIdResponse, *xendit.Error)

ListPaymentMethodsWithContext returns a list of matching Payment objects made on a Payment Method

func (*Client) ListRefunds

func (c *Client) ListRefunds(data *ListRefundsParams) (*ListRefundsResponse, *xendit.Error)

ListPaymentMethods returns a list of matching Refund objects based on the provided query

func (*Client) ListRefundsWithContext

func (c *Client) ListRefundsWithContext(ctx context.Context, data *ListRefundsParams) (*ListRefundsResponse, *xendit.Error)

ListPaymentMethodsWithContext returns a list of matching Refund objects based on the provided query

type CreatePaymentMethodParams

type CreatePaymentMethodParams struct {
	IdempotencyKey     string                    `json:"-"`
	ForUserID          string                    `json:"-"`
	Type               string                    `json:"type"`
	Reusability        string                    `json:"reusability"`
	ReferenceID        string                    `json:"reference_id,omitempty"`
	CustomerID         string                    `json:"customer_id,omitempty"`
	Country            string                    `json:"country"`
	Description        string                    `json:"description,omitempty"`
	BillingInformation xendit.BillingInformation `json:"billing_information,omitempty"`
	Metadata           map[string]interface{}    `json:"metadata,omitempty"`
	Ewallet            xendit.Ewallet            `json:"ewallet,omitempty"`
	DirectDebit        xendit.DirectDebit        `json:"direct_debit,omitempty"`
	Card               xendit.Card               `json:"card,omitempty"`
	OverTheCounter     xendit.OverTheCounter     `json:"over_the_counter,omitempty"`
	VirtualAccount     xendit.VirtualAccount2    `json:"virtual_account,omitempty"`
	QrCode             xendit.QrCode             `json:"qr_code,omitempty"`
}

CreatePaymentMethodParams contains parameters for CreatePaymentMethod

type CreatePaymentRequestParams

type CreatePaymentRequestParams struct {
	IdempotencyKey    string                   `json:"-"`
	ForUserID         string                   `json:"-"`
	Currency          string                   `json:"currency"`
	Amount            float64                  `json:"amount"`
	ReferenceID       string                   `json:"reference_id,omitempty"`
	CustomerID        string                   `json:"customer_id,omitempty"`
	Country           string                   `json:"country"`
	Description       string                   `json:"description,omitempty"`
	PaymentMethod     xendit.PaymentMethod2    `json:"payment_method"`
	PaymentMethodID   string                   `json:"payment_method_id"`
	ChannelProperties xendit.ChannelProperties `json:"channel_properties"`
	Metadata          map[string]interface{}   `json:"metadata,omitempty"`
}

CreatePaymentRequestParams contains parameters for CreatePaymentRequest

type CreateRefundParams

type CreateRefundParams struct {
	IdempotencyKey   string                 `json:"-"`
	ForUserID        string                 `json:"-"`
	PaymentRequestID string                 `json:"payment_request_id"`
	ReferenceID      string                 `json:"reference_id,omitempty"`
	InvoiceID        string                 `json:"invoice_id"`
	Currency         string                 `json:"currency"`
	Amount           float64                `json:"amount"`
	Reason           string                 `json:"reason"`
	Metadata         map[string]interface{} `json:"metadata,omitempty"`
}

CreateRefundParams contains parameters for CreateRefund

type GetPaymentMethodByIdParams added in v1.0.10

type GetPaymentMethodByIdParams struct {
	ForUserID string `json:"-"`
	ID        string `json:"-"`
}

GetPaymentMethodByIdParams contains parameters for GetPaymentMethodById

type GetPaymentRequestByIdParams added in v1.0.11

type GetPaymentRequestByIdParams struct {
	ForUserID string `json:"-"`
	ID        string `json:"-"`
}

GetPaymentRequestByIdParams contains parameters for GetPaymentRequestById

type GetRefundByIdParams

type GetRefundByIdParams struct {
	ForUserID string `json:"-"`
	ID        string `json:"-"`
}

ListPaymentRequestsParams contains parameters for CreatePaymentRequest

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

type ListPaymentMethodsParams

type ListPaymentMethodsParams struct {
	ForUserID   string  `json:"-"`
	ID          string  `json:"id"`
	Type        string  `json:"type"`
	Reusability string  `json:"reusability"`
	ReferenceID string  `json:"reference_id,omitempty"`
	CustomerID  string  `json:"customer_id,omitempty"`
	Limit       float64 `json:"limit"`
	AfterID     string  `json:"after_id"`
	BeforeID    string  `json:"before_id"`
}

ListPaymentMethodsParams contains parameters for ListPaymentMethods

func (*ListPaymentMethodsParams) QueryString

func (p *ListPaymentMethodsParams) QueryString() string

QueryString creates query string from ListPaymentMethodsParams, ignores nil values

type ListPaymentMethodsResponse

type ListPaymentMethodsResponse struct {
	Data    []xendit.PaymentMethod2 `json:"data"`
	HasMore bool                    `json:"has_more"`
}

func ListPaymentMethods

func ListPaymentMethods(data *ListPaymentMethodsParams) (*ListPaymentMethodsResponse, *xendit.Error)

ListPaymentMethods returns a list of matching Payment Method objects based on the provided query

func ListPaymentMethodsWithContext

func ListPaymentMethodsWithContext(ctx context.Context, data *ListPaymentMethodsParams) (*ListPaymentMethodsResponse, *xendit.Error)

ListPaymentMethodsWithContext returns a list of matching Payment Method objects based on the provided query

type ListPaymentRequestsParams

type ListPaymentRequestsParams struct {
	ForUserID   string  `json:"-"`
	ReferenceID string  `json:"reference_id,omitempty"`
	CustomerID  string  `json:"customer_id,omitempty"`
	Type        string  `json:"type"`
	ChannelCode string  `json:"channel_code"`
	Status      string  `json:"status"`
	Limit       float64 `json:"limit"`
	AfterID     string  `json:"after_id"`
	BeforeID    string  `json:"before_id"`
}

ListPaymentRequestsParams contains parameters for ListPaymentRequests

func (*ListPaymentRequestsParams) QueryString

func (p *ListPaymentRequestsParams) QueryString() string

QueryString creates query string from ListPaymentRequestsParams, ignores nil values

type ListPaymentRequestsResponse

type ListPaymentRequestsResponse struct {
	Data    []xendit.PaymentRequest `json:"data"`
	HasMore bool                    `json:"has_more"`
}

func ListPaymentRequests

func ListPaymentRequests(data *ListPaymentRequestsParams) (*ListPaymentRequestsResponse, *xendit.Error)

ListPaymentRequests returns a list of matching Payment Request objects based on the provided query.

func ListPaymentRequestsWithContext

func ListPaymentRequestsWithContext(ctx context.Context, data *ListPaymentRequestsParams) (*ListPaymentRequestsResponse, *xendit.Error)

ListPaymentRequestsWithContext returns a list of matching Payment Request objects based on the provided query.

type ListPaymentsByPaymentMethodIdParams

type ListPaymentsByPaymentMethodIdParams struct {
	ForUserID        string  `json:"-"`
	ID               string  `json:"-"`
	PaymentRequestID string  `json:"payment_request_id"`
	ReferenceID      string  `json:"reference_id,omitempty"`
	Status           string  `json:"status"`
	Limit            float64 `json:"limit"`
	AfterID          string  `json:"after_id"`
	BeforeID         string  `json:"before_id"`
}

ListPaymentMethodsParams contains parameters for ListPaymentMethods

func (*ListPaymentsByPaymentMethodIdParams) QueryString

QueryString creates query string from ListPaymentMethodsParams, ignores nil values

type ListPaymentsByPaymentMethodIdResponse

type ListPaymentsByPaymentMethodIdResponse struct {
	Data    []xendit.Payment `json:"data"`
	HasMore bool             `json:"has_more"`
	Links   []Link           `json:"links"`
}

func ListPaymentsByPaymentMethodId

func ListPaymentsByPaymentMethodId(data *ListPaymentsByPaymentMethodIdParams) (*ListPaymentsByPaymentMethodIdResponse, *xendit.Error)

ListPaymentsByPayentMethodId returns a list of matching Payment objects made on a Payment Method

func ListPaymentsByPaymentMethodIdWithContext

func ListPaymentsByPaymentMethodIdWithContext(ctx context.Context, data *ListPaymentsByPaymentMethodIdParams) (*ListPaymentsByPaymentMethodIdResponse, *xendit.Error)

ListPaymentsByPayentMethodIdWithContext returns a list of matching Payment objects made on a Payment Method

type ListRefundsParams

type ListRefundsParams struct {
	ForUserID         string  `json:"-"`
	PaymentRequestID  string  `json:"payment_request_id"`
	InvoiceID         string  `json:"invoice_id"`
	PaymentMethodType string  `json:"payment_method_type"`
	ChannelCode       string  `json:"channel_code"`
	Limit             float64 `json:"limit"`
	AfterID           string  `json:"after_id"`
	BeforeID          string  `json:"before_id"`
}

ListPaymentRequestsParams contains parameters for ListPaymentRequests

func (*ListRefundsParams) QueryString

func (p *ListRefundsParams) QueryString() string

QueryString creates query string from ListPaymentRequestsParams, ignores nil values

type ListRefundsResponse

type ListRefundsResponse struct {
	Data    []xendit.Refund `json:"data"`
	HasMore bool            `json:"has_more"`
	Links   []Link          `json:"links"`
}

func ListRefunds

func ListRefunds(data *ListRefundsParams) (*ListRefundsResponse, *xendit.Error)

ListPaymentMethods returns a list of matching Refund objects based on the provided query

func ListRefundsWithContext

func ListRefundsWithContext(ctx context.Context, data *ListRefundsParams) (*ListRefundsResponse, *xendit.Error)

ListPaymentMethodsWithContext returns a list of matching Refund objects based on the provided query

Jump to

Keyboard shortcuts

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