charge

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankAccount

type BankAccount struct {
	Code          string `json:"code,omitempty"`
	AccountNumber string `json:"account_number,omitempty"`
}

BankAccount is used as bank in a charge request

type Card

type Card struct {
	Number            string `json:"card_number,omitempty"`
	CVV               string `json:"card_cvc,omitempty"`
	ExpirtyMonth      string `json:"expiry_month,omitempty"`
	ExpiryYear        string `json:"expiry_year,omitempty"`
	AddressLine1      string `json:"address_line1,omitempty"`
	AddressLine2      string `json:"address_line2,omitempty"`
	AddressLine3      string `json:"address_line3,omitempty"`
	AddressCountry    string `json:"address_country,omitempty"`
	AddressPostalCode string `json:"address_postal_code,omitempty"`
	Country           string `json:"country,omitempty"`
}

Card represents a Card object

type ChargeRequest

type ChargeRequest struct {
	Email             string           `json:"email,omitempty"`
	Amount            float32          `json:"amount,omitempty"`
	Birthday          string           `json:"birthday,omitempty"`
	Card              *Card            `json:"card,omitempty"`
	Bank              *BankAccount     `json:"bank,omitempty"`
	AuthorizationCode string           `json:"authorization_code,omitempty"`
	Pin               string           `json:"pin,omitempty"`
	Metadata          *client.Metadata `json:"metadata,omitempty"`
	Reference         string           `json:"reference,omitempty"`
}

ChargeRequest represents a Paystack charge request

type DefaultChargeService

type DefaultChargeService struct {
	*client.Client
}

DefaultChargeService handles operations related to bulk charges For more details see https://developers.paystack.co/v1.0/reference#charge-tokenize

func (*DefaultChargeService) CheckPending

func (s *DefaultChargeService) CheckPending(ctx context.Context, reference string) (response.Response, error)

CheckPending returns pending charges When you get "pending" as a charge status, wait 30 seconds or more, then make a check to see if its status has changed. Don't call too early as you may get a lot more pending than you should. For more details see https://developers.paystack.co/v1.0/reference#check-pending-charge

func (*DefaultChargeService) Create

Create submits a charge request using card details or bank details or authorization code For more details see https://developers.paystack.co/v1.0/reference#charge

func (*DefaultChargeService) SubmitBirthday

func (s *DefaultChargeService) SubmitBirthday(ctx context.Context, birthday, reference string) (response.Response, error)

SubmitBirthday submits Birthday when requested For more details see https://developers.paystack.co/v1.0/reference#submit-pin

func (*DefaultChargeService) SubmitOTP

func (s *DefaultChargeService) SubmitOTP(ctx context.Context, otp, reference string) (response.Response, error)

SubmitOTP submits OTP to continue a charge For more details see https://developers.paystack.co/v1.0/reference#submit-pin

func (*DefaultChargeService) SubmitPIN

func (s *DefaultChargeService) SubmitPIN(ctx context.Context, pin, reference string) (response.Response, error)

SubmitPIN submits PIN to continue a charge For more details see https://developers.paystack.co/v1.0/reference#submit-pin

func (*DefaultChargeService) SubmitPhone

func (s *DefaultChargeService) SubmitPhone(ctx context.Context, phone, reference string) (response.Response, error)

SubmitPhone submits Phone when requested For more details see https://developers.paystack.co/v1.0/reference#submit-pin

func (*DefaultChargeService) Tokenize

Tokenize tokenizes payment instrument before a charge For more details see https://developers.paystack.co/v1.0/reference#charge-tokenize

type Service

type Service interface {
	Create(ctx context.Context, req *ChargeRequest) (response.Response, error)
	Tokenize(ctx context.Context, req *ChargeRequest) (response.Response, error)
	SubmitPIN(ctx context.Context, pin, reference string) (response.Response, error)
	SubmitOTP(ctx context.Context, otp, reference string) (response.Response, error)
	SubmitPhone(ctx context.Context, phone, reference string) (response.Response, error)
	SubmitBirthday(ctx context.Context, birthday, reference string) (response.Response, error)
	CheckPending(ctx context.Context, reference string) (response.Response, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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