Documentation ¶
Index ¶
- func Create(data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
- func CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
- func Edit(data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
- func EditWithContext(ctx context.Context, data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
- func Get(data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
- func GetWithContext(ctx context.Context, data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
- func Pause(data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
- func PauseWithContext(ctx context.Context, data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
- func Resume(data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
- func ResumeWithContext(ctx context.Context, data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
- func Stop(data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
- func StopWithContext(ctx context.Context, data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
- type Client
- func (c *Client) Create(data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) Edit(data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) EditWithContext(ctx context.Context, data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) Get(data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) GetWithContext(ctx context.Context, data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) Pause(data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) PauseWithContext(ctx context.Context, data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) Resume(data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) ResumeWithContext(ctx context.Context, data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) Stop(data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
- func (c *Client) StopWithContext(ctx context.Context, data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
- type CreateParams
- type EditParams
- type GetParams
- type PauseParams
- type ResumeParams
- type StopParams
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
Create creates new recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" createData := recurringpayment.CreateParams{ ExternalID: "recurringpayment-" + time.Now().String(), Amount: 200000, PayerEmail: "customer@customer.com", Description: "recurringpayment #1", Interval: xendit.RecurringPaymentIntervalDay, IntervalCount: 3, } resp, err := recurringpayment.Create(&createData) if err != nil { log.Fatal(err) } fmt.Printf("created recurring payment: %+v\n", resp)
Output:
func CreateWithContext ¶
func CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
CreateWithContext creates new recurring payment with context
func Edit ¶
func Edit(data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
Edit gets a recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" editData := recurringpayment.EditParams{ ID: "123", Amount: 500000, Interval: xendit.RecurringPaymentIntervalMonth, IntervalCount: 3, } resp, err := recurringpayment.Edit(&editData) if err != nil { log.Fatal(err) } fmt.Printf("edited recurring payment: %+v\n", resp)
Output:
func EditWithContext ¶
func EditWithContext(ctx context.Context, data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
EditWithContext gets a recurring payment with context
func Get ¶
func Get(data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
Get gets a recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" getData := recurringpayment.GetParams{ ID: "123", } resp, err := recurringpayment.Get(&getData) if err != nil { log.Fatal(err) } fmt.Printf("retrieved recurring payment: %+v\n", resp)
Output:
func GetWithContext ¶
GetWithContext gets a recurring payment with context
func Pause ¶
func Pause(data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
Pause gets a recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" pauseData := recurringpayment.PauseParams{ ID: "123", } resp, err := recurringpayment.Pause(&pauseData) if err != nil { log.Fatal(err) } fmt.Printf("paused recurring payment: %+v\n", resp)
Output:
func PauseWithContext ¶
func PauseWithContext(ctx context.Context, data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
PauseWithContext gets a recurring payment with context
func Resume ¶
func Resume(data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
Resume gets a recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" resumeData := recurringpayment.ResumeParams{ ID: "123", } resp, err := recurringpayment.Resume(&resumeData) if err != nil { log.Fatal(err) } fmt.Printf("resumed recurring payment: %+v\n", resp)
Output:
func ResumeWithContext ¶
func ResumeWithContext(ctx context.Context, data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
ResumeWithContext gets a recurring payment with context
func Stop ¶
func Stop(data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
Stop gets a recurring payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" stopData := recurringpayment.StopParams{ ID: "123", } resp, err := recurringpayment.Stop(&stopData) if err != nil { log.Fatal(err) } fmt.Printf("stopped recurring payment: %+v\n", resp)
Output:
func StopWithContext ¶
func StopWithContext(ctx context.Context, data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
StopWithContext gets a recurring payment with context
Types ¶
type Client ¶
type Client struct { Opt *xendit.Option APIRequester xendit.APIRequester }
Client is the client used to invoke invoice API.
func (*Client) Create ¶
func (c *Client) Create(data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
Create creates new recurring payment
func (*Client) CreateWithContext ¶
func (c *Client) CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.RecurringPayment, *xendit.Error)
CreateWithContext creates new recurring payment with context
func (*Client) Edit ¶
func (c *Client) Edit(data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
Edit edits a recurring payment
func (*Client) EditWithContext ¶
func (c *Client) EditWithContext(ctx context.Context, data *EditParams) (*xendit.RecurringPayment, *xendit.Error)
EditWithContext edits a recurring payment with context
func (*Client) GetWithContext ¶
func (c *Client) GetWithContext(ctx context.Context, data *GetParams) (*xendit.RecurringPayment, *xendit.Error)
GetWithContext gets one recurring payment with context
func (*Client) Pause ¶
func (c *Client) Pause(data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
Pause pauses one recurring payment
func (*Client) PauseWithContext ¶
func (c *Client) PauseWithContext(ctx context.Context, data *PauseParams) (*xendit.RecurringPayment, *xendit.Error)
PauseWithContext pauses one recurring payment with context
func (*Client) Resume ¶
func (c *Client) Resume(data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
Resume resumes one recurring payment
func (*Client) ResumeWithContext ¶
func (c *Client) ResumeWithContext(ctx context.Context, data *ResumeParams) (*xendit.RecurringPayment, *xendit.Error)
ResumeWithContext resumes one recurring payment with context
func (*Client) Stop ¶
func (c *Client) Stop(data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
Stop stops one recurring payment
func (*Client) StopWithContext ¶
func (c *Client) StopWithContext(ctx context.Context, data *StopParams) (*xendit.RecurringPayment, *xendit.Error)
StopWithContext stops one recurring payment with context
type CreateParams ¶
type CreateParams struct { ForUserID string `json:"-"` ExternalID string `json:"external_id" validate:"required"` PayerEmail string `json:"payer_email" validate:"required"` Description string `json:"description" validate:"required"` Amount float64 `json:"amount" validate:"required"` Interval xendit.RecurringPaymentIntervalEnum `json:"interval" validate:"required"` IntervalCount int `json:"interval_count" validate:"required"` TotalRecurrence int `json:"total_recurrence,omitempty"` InvoiceDuration int `json:"invoice_duration,omitempty"` ShouldSendEmail *bool `json:"should_send_email,omitempty"` Customer xendit.RecurringPaymentCustomer `json:"customer,omitempty"` CustomerNotificationPreference xendit.CustomerNotificationPreference `json:"customer_notification_preference,omitempty"` MissedPaymentAction xendit.MissedPaymentActionEnum `json:"missed_payment_action,omitempty"` CreditCardToken string `json:"credit_card_token,omitempty"` StartDate *time.Time `json:"start_date,omitempty"` SuccessRedirectURL string `json:"success_redirect_url,omitempty"` FailureRedirectURL string `json:"failure_redirect_url,omitempty"` Recharge *bool `json:"recharge,omitempty"` ChargeImmediately *bool `json:"charge_immediately,omitempty"` Currency string `json:"currency,omitempty"` }
CreateParams contains parameters for Create
type EditParams ¶
type EditParams struct { ID string `json:"-" validate:"required"` Amount float64 `json:"amount,omitempty"` Interval xendit.RecurringPaymentIntervalEnum `json:"interval,omitempty"` IntervalCount int `json:"interval_count,omitempty"` InvoiceDuration int `json:"invoice_duration,omitempty"` ShouldSendEmail *bool `json:"should_send_email,omitempty"` MissedPaymentAction xendit.MissedPaymentActionEnum `json:"missed_payment_action,omitempty"` CreditCardToken string `json:"credit_card_token,omitempty"` }
EditParams contains parameters for Edit
type GetParams ¶
type GetParams struct {
ID string `json:"id" validate:"required"`
}
GetParams contains parameters for Get
type PauseParams ¶
type PauseParams struct {
ID string `json:"id" validate:"required"`
}
PauseParams contains parameters for Pause
type ResumeParams ¶
type ResumeParams struct {
ID string `json:"id" validate:"required"`
}
ResumeParams contains parameters for Resume
type StopParams ¶
type StopParams struct {
ID string `json:"id" validate:"required"`
}
StopParams contains parameters for Stop