Documentation ¶
Index ¶
- func CreatePaymentMethod(data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)
- func CreatePaymentMethodWithContext(ctx context.Context, data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)
- func GetPaymentMethodsByCustomerID(data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)
- func GetPaymentMethodsByCustomerIDWithContext(ctx context.Context, data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)
- type Client
- func (c *Client) CreatePaymentMethod(data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)
- func (c *Client) CreatePaymentMethodWithContext(ctx context.Context, data *CreatePaymentMethodParams) (*xendit.PaymentMethod, *xendit.Error)
- func (c *Client) GetPaymentMethodsByCustomerID(data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)
- func (c *Client) GetPaymentMethodsByCustomerIDWithContext(ctx context.Context, data *GetPaymentMethodsByCustomerIDParams) ([]xendit.PaymentMethod, *xendit.Error)
- type CreatePaymentMethodParams
- type GetPaymentMethodsByCustomerIDParams
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 ¶
func (p *GetPaymentMethodsByCustomerIDParams) QueryString() string
QueryString creates query string from GetPaymentMethodsByCustomerIDParams, ignores nil values