Documentation ¶
Index ¶
- func CreateEWalletCharge(data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
- func CreateEWalletChargeWithContext(ctx context.Context, data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
- func CreatePayment(data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
- func CreatePaymentWithContext(ctx context.Context, data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
- func GetEWalletChargeStatus(data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
- func GetEWalletChargeStatusWithContext(ctx context.Context, data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
- func GetPaymentStatus(data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
- func GetPaymentStatusWithContext(ctx context.Context, data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
- type Client
- func (c *Client) CreateEWalletCharge(data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
- func (c *Client) CreateEWalletChargeWithContext(ctx context.Context, data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
- func (c *Client) CreatePayment(data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
- func (c *Client) CreatePaymentWithContext(ctx context.Context, data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
- func (c *Client) GetEWalletChargeStatus(data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
- func (c *Client) GetEWalletChargeStatusWithContext(ctx context.Context, data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
- func (c *Client) GetPaymentStatus(data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
- func (c *Client) GetPaymentStatusWithContext(ctx context.Context, data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
- type CreateEWalletChargeParams
- type CreatePaymentParams
- type GetEWalletChargeStatusParams
- type GetPaymentStatusParams
- type Item
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEWalletCharge ¶
func CreateEWalletCharge(data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
CreateEWalletCharge creates new e-wallet charge
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" ewalletBasketItem := xendit.EWalletBasketItem{ ReferenceID: "basket-product-ref-id", Name: "product name", Category: "mechanics", Currency: "IDR", Price: 50000, Quantity: 5, Type: "type", SubCategory: "subcategory", Metadata: map[string]interface{}{ "meta": "data", }, } data := ewallet.CreateEWalletChargeParams{ ReferenceID: "test-reference-id", Currency: "IDR", Amount: 1688, CheckoutMethod: "ONE_TIME_PAYMENT", ChannelCode: "ID_SHOPEEPAY", ChannelProperties: map[string]string{ "success_redirect_url": "https://yourwebsite.com/order/123", }, Basket: []xendit.EWalletBasketItem{ ewalletBasketItem, }, Metadata: map[string]interface{}{ "meta": "data", }, } charge, chargeErr := ewallet.CreateEWalletCharge(&data) if chargeErr != nil { log.Fatal(chargeErr) } fmt.Printf("created e-wallet charge: %+v\n", charge)
Output:
func CreateEWalletChargeWithContext ¶
func CreateEWalletChargeWithContext(ctx context.Context, data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
CreateEWalletChargeWithContext creates new e-wallet charge
func CreatePayment ¶
func CreatePayment(data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
CreatePayment creates new payment
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := ewallet.CreatePaymentParams{ ExternalID: "dana-ewallet", Amount: 20000, Phone: "08123123123", EWalletType: xendit.EWalletTypeDANA, CallbackURL: "mystore.com/callback", RedirectURL: "mystore.com/redirect", } resp, err := ewallet.CreatePayment(&data) if err != nil { log.Fatal(err) } fmt.Printf("created payment: %+v\n", resp)
Output:
func CreatePaymentWithContext ¶
func CreatePaymentWithContext(ctx context.Context, data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
CreatePaymentWithContext creates new payment
func GetEWalletChargeStatus ¶
func GetEWalletChargeStatus(data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
GetEWalletChargeStatus gets one e-wallet charge with its status
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := ewallet.GetEWalletChargeStatusParams{ ChargeID: "ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c", } charge, chargeErr := ewallet.GetEWalletChargeStatus(&data) if chargeErr != nil { log.Fatal(chargeErr) } fmt.Printf("retrieved e-wallet charge: %+v\n", charge)
Output:
func GetEWalletChargeStatusWithContext ¶
func GetEWalletChargeStatusWithContext(ctx context.Context, data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
GetEWalletChargeStatusWithContext gets one e-wallet with its status
func GetPaymentStatus ¶
func GetPaymentStatus(data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
GetPaymentStatus gets one payment with its status
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := ewallet.GetPaymentStatusParams{ ExternalID: "data-ewallet", EWalletType: xendit.EWalletTypeDANA, } resp, err := ewallet.GetPaymentStatus(&data) if err != nil { log.Fatal(err) } fmt.Printf("retrieved payment: %+v\n", resp)
Output:
func GetPaymentStatusWithContext ¶
func GetPaymentStatusWithContext(ctx context.Context, data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
GetPaymentStatusWithContext gets one payment with its status
Types ¶
type Client ¶
type Client struct { Opt *xendit.Option APIRequester xendit.APIRequester }
Client is the client used to invoke e-wallet API.
func (*Client) CreateEWalletCharge ¶
func (c *Client) CreateEWalletCharge(data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
CreateEWalletCharge creates new e-wallet charge
func (*Client) CreateEWalletChargeWithContext ¶
func (c *Client) CreateEWalletChargeWithContext(ctx context.Context, data *CreateEWalletChargeParams) (*xendit.EWalletCharge, *xendit.Error)
CreateEWalletChargeWithContext creates new e-wallet charge
func (*Client) CreatePayment ¶
func (c *Client) CreatePayment(data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
CreatePayment creates new payment
func (*Client) CreatePaymentWithContext ¶
func (c *Client) CreatePaymentWithContext(ctx context.Context, data *CreatePaymentParams) (*xendit.EWallet, *xendit.Error)
CreatePaymentWithContext creates new payment
func (*Client) GetEWalletChargeStatus ¶
func (c *Client) GetEWalletChargeStatus(data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
GetEWalletChargeStatus gets one e-wallet charge with its status
func (*Client) GetEWalletChargeStatusWithContext ¶
func (c *Client) GetEWalletChargeStatusWithContext(ctx context.Context, data *GetEWalletChargeStatusParams) (*xendit.EWalletCharge, *xendit.Error)
GetPaymentStatusWithContext gets one payment with its status
func (*Client) GetPaymentStatus ¶
func (c *Client) GetPaymentStatus(data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
GetPaymentStatus gets one payment with its status
func (*Client) GetPaymentStatusWithContext ¶
func (c *Client) GetPaymentStatusWithContext(ctx context.Context, data *GetPaymentStatusParams) (*xendit.EWallet, *xendit.Error)
GetPaymentStatusWithContext gets one payment with its status
type CreateEWalletChargeParams ¶
type CreateEWalletChargeParams struct { ForUserID string `json:"-"` WithFeeRule string `json:"-"` ReferenceID string `json:"reference_id" validate:"required"` Currency string `json:"currency" validate:"required"` Amount float64 `json:"amount" validate:"required"` CheckoutMethod string `json:"checkout_method" validate:"required"` ChannelCode string `json:"channel_code,omitempty"` ChannelProperties map[string]string `json:"channel_properties,omitempty"` CaptureNow bool `json:"capture_now,omitempty"` CustomerID string `json:"customer_id,omitempty"` PaymentMethodID string `json:"payment_method_id,omitempty"` Customer *xendit.EwalletCustomer `json:"customer,omitempty"` ShippingInformation *xendit.ShippingInformation `json:"shipping_information,omitempty"` Basket []xendit.EWalletBasketItem `json:"basket,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
CreateEWalletChargeParams contains parameters for CreateEWalletCharge
type CreatePaymentParams ¶
type CreatePaymentParams struct { XApiVersion string `json:"-"` ForUserID string `json:"-"` EWalletType xendit.EWalletTypeEnum `json:"ewallet_type" validate:"required"` ExternalID string `json:"external_id" validate:"required"` Amount float64 `json:"amount" validate:"required"` Phone string `json:"phone,omitempty"` ExpirationDate *time.Time `json:"expiration_date,omitempty"` CallbackURL string `json:"callback_url,omitempty"` RedirectURL string `json:"redirect_url,omitempty"` Items []Item `json:"items,omitempty"` }
CreatePaymentParams contains parameters for CreatePayment
type GetEWalletChargeStatusParams ¶
type GetEWalletChargeStatusParams struct { ForUserID string `json:"-"` ChargeID string `json:"charge_id" validate:"required"` }
GetEWalletChargeStatusParams contains parameters for GetEWalletChargeStatus
type GetPaymentStatusParams ¶
type GetPaymentStatusParams struct { ExternalID string `json:"external_id" validate:"required"` EWalletType xendit.EWalletTypeEnum `json:"ewallet_type" validate:"required"` }
GetPaymentStatusParams contains parameters for GetPaymentStatus
func (*GetPaymentStatusParams) QueryString ¶
func (p *GetPaymentStatusParams) QueryString() string
QueryString creates query string from GetPaymentStatusParams, ignores nil values