paymentmethod

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePaymentMethod

func CreatePaymentMethod(data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)

CreatePaymentMethod creates new payment method

Example
xendit.Opt.SecretKey = "examplesecretkey"

properties := map[string]interface{}{
	"id": "test-la-id",
}

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

data := paymentmethod.CreatePaymentMethodParams{
	CustomerID: "test-cust-id",
	Type:       xendit.DEBIT_CARD,
	Properties: properties,
	Metadata:   metadata,
}

resp, err := paymentmethod.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 *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)

CreatePaymentMethodWithContext creates new payment method

func GetPaymentMethodsByCustomerID

func GetPaymentMethodsByCustomerID(data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)

GetPaymentMethodsByCustomerID gets payment methods by customer ID

Example
xendit.Opt.SecretKey = "examplesecretkey"

data := paymentmethod.GetPaymentMethodsByCustomerIDParams{
	CustomerID: "test-cust-id",
}

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

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

func GetPaymentMethodsByCustomerIDWithContext

func GetPaymentMethodsByCustomerIDWithContext(ctx context.Context, data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)

GetPaymentMethodsByCustomerIDWithContext gets payment methods by customer ID

Types

type Client

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

Client is the client used to invoke e-wallet API.

func (*Client) CreatePaymentMethod

func (c *Client) CreatePaymentMethod(data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)

CreatePaymentMethod creates new payment method

func (*Client) CreatePaymentMethodWithContext

func (c *Client) CreatePaymentMethodWithContext(ctx context.Context, data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)

CreatePaymentMethodWithContext creates new payment method

func (*Client) GetPaymentMethodsByCustomerID

func (c *Client) GetPaymentMethodsByCustomerID(data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)

GetPaymentMethodsByCustomerIDParams gets payment methods by customer ID

func (*Client) GetPaymentMethodsByCustomerIDWithContext

func (c *Client) GetPaymentMethodsByCustomerIDWithContext(ctx context.Context, data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)

GetPaymentMethodsByCustomerIDWithContext gets payment methods by customer ID

type CreatePaymentMethodParams

type CreatePaymentMethodParams struct {
	ForUserID  string                 `json:"-"`
	CustomerID string                 `json:"customer_id" validate:"required"`
	Type       xendit.AccountTypeEnum `json:"type" validate:"required"`
	Properties map[string]interface{} `json:"properties" validate:"required"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

CreatePaymentMethodParams contains parameters for CreatePaymentMethod

type GetPaymentMethodsByCustomerIDParams

type GetPaymentMethodsByCustomerIDParams struct {
	ForUserID  string `json:"-"`
	CustomerID string `json:"customer_id" validate:"required"`
}

GetPaymentMethodsByCustomerIDParams contains parameters for GetPaymentMethodsByCustomerID

func (*GetPaymentMethodsByCustomerIDParams) QueryString

QueryString creates query string from GetPaymentMethodsByCustomerIDParams, ignores nil values

Jump to

Keyboard shortcuts

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