Documentation ¶
Index ¶
- Constants
- type APIError
- type AccessToken
- type Client
- func (c *Client) BankCheckout(ctx context.Context, p *pay.BankCheckoutPayload) (res *pay.BankCheckoutResponse, err error)
- func (c *Client) BankCheckoutValidate(ctx context.Context, p *pay.BankCheckoutValidatePayload) (res *pay.BankCheckoutValidateResponse, err error)
- func (c *Client) BankTransfer(ctx context.Context, p *pay.BankTransferPayload) (res *pay.BankTransferResponse, err error)
- func (c *Client) CardCheckout(ctx context.Context, p *pay.CardCheckoutPayload) (res *pay.CardCheckoutResponse, err error)
- func (c *Client) CardCheckoutValidate(ctx context.Context, p *pay.CardCheckoutValidatePayload) (res *pay.CardCheckoutValidateResponse, err error)
- func (c *Client) Dequeue(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) Dial(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) Enqueue(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) FetchPremiumSubscription(ctx context.Context, p *sms.FetchSubPayload) (res *sms.FetchSubResponse, err error)
- func (c *Client) FetchProductTransactions(ctx context.Context, p *pay.ProductTransactionsPayload) (res *pay.ProductTransactionsResponse, err error)
- func (c *Client) FetchSMS(ctx context.Context, p *sms.FetchMsgPayload) (res *sms.FetchMsgResponse, err error)
- func (c *Client) FetchWalletBalance(ctx context.Context, p *pay.WalletBalancePayload) (res *pay.WalletBalanceResponse, err error)
- func (c *Client) FetchWalletTransactions(ctx context.Context, p *pay.WalletTransactionsPayload) (res *pay.WalletTransactionsResponse, err error)
- func (c *Client) FindTransaction(ctx context.Context, p *pay.FindTransactionPayload) (res *pay.FindTransactionResponse, err error)
- func (c *Client) GenerateToken(ctx context.Context, p *user.GeneratePayload) (res *user.AccessTokenResponse, err error)
- func (c *Client) GetDigits(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) InitiateAppData(ctx context.Context, p string) (res *user.UserResponse, err error)
- func (c *Client) MakeCall(ctx context.Context, args map[string]string) (res *voice.MakeCallResponse, err error)
- func (c *Client) MobileB2B(ctx context.Context, p *pay.MobileB2BPayload) (res *pay.MobileB2BResponse, err error)
- func (c *Client) MobileB2C(ctx context.Context, p *pay.MobileB2CPayload) (res *pay.MobileB2CResponse, err error)
- func (c *Client) MobileCheckout(ctx context.Context, p *pay.MobileCheckoutPayload) (res *pay.MobileCheckoutResponse, err error)
- func (c *Client) NewCheckoutToken(ctx context.Context, args map[string]string) (res *sms.CheckoutTokenResponse, err error)
- func (c *Client) NewPremiumSubscription(ctx context.Context, args map[string]string) (res *sms.NewSubResponse, err error)
- func (c *Client) Play(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) PublishIoT(ctx context.Context, p *edge.IoTPayload) (res *edge.IoTResponse, err error)
- func (c *Client) PurgePremiumSubscription(ctx context.Context, args map[string]string) (res *sms.PurgeSubResponse, err error)
- func (c *Client) QueuedCall(ctx context.Context, args map[string]string) (res *voice.QueuedStatusResult, err error)
- func (c *Client) Record(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) Redirect(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) Reject(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) Say(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) SendAirtime(ctx context.Context, args map[string]string) (res *airtyme.AirtimeResponse, err error)
- func (c *Client) SendBulkSMS(ctx context.Context, args map[string]string) (res *sms.BulkResponse, err error)
- func (c *Client) SendPremiumSMS(ctx context.Context, args map[string]string) (res *sms.PremiumSMSResponse, err error)
- func (c *Client) TopupStash(ctx context.Context, p *pay.TopupStashPayload) (res *pay.TopupStashResponse, err error)
- func (c *Client) TransferCall(ctx context.Context, args map[string]string) (res *voice.CallTransferResponse, err error)
- func (c *Client) UploadMedia(ctx context.Context, args map[string]string) (res string, err error)
- func (c *Client) WalletTransfer(ctx context.Context, p *pay.WalletTransferPayload) (res *pay.WalletTransferResponse, err error)
- type ErrorResponse
- type ErrorResponseDetail
- type Logger
Constants ¶
const ( SMSTestURL = "https://api.sandbox.africastalking.com" VoiceTestURL = "https://calls.sandbox.africastalking.com" PaymentTestURL = "https://payments.sandbox.africastalking.com" AirtimeTestURL = "https://api.sandbox.africastalking.com" UserTestURL = "https://api.sandbox.africastalking.com" )
Sandbox Endpoints
const ( SMSBaseURL = "https://api.africastalking.com" VoiceBaseURL = "https://calls.africastalking.com" PaymentBaseURL = "https://payments.africastalking.com" AirtimeBaseURL = "https://api.africastalking.com" IoTBaseURL = "https://iot.africastalking.com" UserBaseURL = "https://api.africastalking.com" AuthBaseURL = "https://api.africastalking.com" )
Production Endpoints
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type Client ¶
type Client struct { Username string BaseURL string AccessToken string UserID string SMSEndpoint string VoiceEndpoint string PaymentEndpoint string AirtimeEndpoint string IoTEndpoint string UserEndpoint string AuthEndpoint string APIKey string HTTPClient *http.Client Log *zap.Logger // *zap.Logger // log the requests. }
func NewAfricasTalkingClient ¶
NewAfricasTalkingClient returns new Client struct Use "test" for Sandbox Environment and "prod" for Production Environment
func (*Client) BankCheckout ¶
func (c *Client) BankCheckout(ctx context.Context, p *pay.BankCheckoutPayload) (res *pay.BankCheckoutResponse, err error)
Collect money into your payment wallet.
func (*Client) BankCheckoutValidate ¶
func (c *Client) BankCheckoutValidate(ctx context.Context, p *pay.BankCheckoutValidatePayload) (res *pay.BankCheckoutValidateResponse, err error)
Validate a bank checkout charge requestFormBody
func (*Client) BankTransfer ¶
func (c *Client) BankTransfer(ctx context.Context, p *pay.BankTransferPayload) (res *pay.BankTransferResponse, err error)
Initiate a bank transfer requestFormBody.
func (*Client) CardCheckout ¶
func (c *Client) CardCheckout(ctx context.Context, p *pay.CardCheckoutPayload) (res *pay.CardCheckoutResponse, err error)
Collect money into your Payment Wallet by initiating transactions that deduct money from a customers Debit or Credit Card. These APIs are currently only available in Nigeria on MasterCard and Verve cards.
func (*Client) CardCheckoutValidate ¶
func (c *Client) CardCheckoutValidate(ctx context.Context, p *pay.CardCheckoutValidatePayload) (res *pay.CardCheckoutValidateResponse, err error)
Allows your application to validate card checkout charge requests.
func (*Client) Dequeue ¶
Pass the calls enqueued to a separate number to be handled. Payload attributes `p *DequeuePayload` passed as key value args.
func (*Client) Dial ¶
Connect the user who called your phone number to an external phone number. Payload attributes `p *DialPayload` passed as key value args.
func (*Client) Enqueue ¶
Pass an incoming calls to a queue to be handled later. Payload attributes `p *EnqueuePayload` passed as key value args.
func (*Client) FetchPremiumSubscription ¶
func (c *Client) FetchPremiumSubscription(ctx context.Context, p *sms.FetchSubPayload) (res *sms.FetchSubResponse, err error)
Incrementally fetch your premium sms subscriptions.
func (*Client) FetchProductTransactions ¶
func (c *Client) FetchProductTransactions(ctx context.Context, p *pay.ProductTransactionsPayload) (res *pay.ProductTransactionsResponse, err error)
Fetch transactions of a particular payment product.
func (*Client) FetchSMS ¶
func (c *Client) FetchSMS(ctx context.Context, p *sms.FetchMsgPayload) (res *sms.FetchMsgResponse, err error)
Incrementally fetch messages from application inbox.
func (*Client) FetchWalletBalance ¶
func (c *Client) FetchWalletBalance(ctx context.Context, p *pay.WalletBalancePayload) (res *pay.WalletBalanceResponse, err error)
Fetch your wallet balance
func (*Client) FetchWalletTransactions ¶
func (c *Client) FetchWalletTransactions(ctx context.Context, p *pay.WalletTransactionsPayload) (res *pay.WalletTransactionsResponse, err error)
Fetch your wallet transactions
func (*Client) FindTransaction ¶
func (c *Client) FindTransaction(ctx context.Context, p *pay.FindTransactionPayload) (res *pay.FindTransactionResponse, err error)
Fetch transactions of a particular payment product.
func (*Client) GenerateToken ¶
func (c *Client) GenerateToken(ctx context.Context, p *user.GeneratePayload) (res *user.AccessTokenResponse, err error)
Generates a valid auth token
func (*Client) GetDigits ¶
Get digits a user enters on their phone in response to a prompt from application Payload attributes `p *GetDigitsPayload` passed as key value args.
func (*Client) InitiateAppData ¶
Initiate an application data requestFormBody.
func (*Client) MakeCall ¶
func (c *Client) MakeCall(ctx context.Context, args map[string]string) (res *voice.MakeCallResponse, err error)
Makes outbound calls. Payload attributes `p *MakeCallPayload` passed as key value args.
func (*Client) MobileB2B ¶
func (c *Client) MobileB2B(ctx context.Context, p *pay.MobileB2BPayload) (res *pay.MobileB2BResponse, err error)
Mobile Business To Business (B2B) APIs allow you to send payments to businesses e.g banks from your Payment Wallet.
func (*Client) MobileB2C ¶
func (c *Client) MobileB2C(ctx context.Context, p *pay.MobileB2CPayload) (res *pay.MobileB2CResponse, err error)
Mobile Business To Consumer (B2C) APIs allow you to send payments to mobile subscribers from your Payment Wallet.
func (*Client) MobileCheckout ¶
func (c *Client) MobileCheckout(ctx context.Context, p *pay.MobileCheckoutPayload) (res *pay.MobileCheckoutResponse, err error)
Mobile Checkout APIs allow you to initiate Customer to Business (C2B) payments on a mobile subscriber’s device. This allows for a smoother checkout experience, since the client will no longer need to remember the amount or an account number to complete the transaction.
func (*Client) NewCheckoutToken ¶
func (c *Client) NewCheckoutToken(ctx context.Context, args map[string]string) (res *sms.CheckoutTokenResponse, err error)
Generate a checkout token Payload attributes `p *CheckoutTokenPayload` passed as key value args.
func (*Client) NewPremiumSubscription ¶
func (c *Client) NewPremiumSubscription(ctx context.Context, args map[string]string) (res *sms.NewSubResponse, err error)
Subscribe a phone number Payload attributes `p *NewSubPayload` passed as key value args.
func (*Client) Play ¶
Play back an audio file located anywhere on the web. Payload attributes `p *PlayPayload` passed as key value args.
func (*Client) PublishIoT ¶
func (c *Client) PublishIoT(ctx context.Context, p *edge.IoTPayload) (res *edge.IoTResponse, err error)
Publishes messages to remote devices.
func (*Client) PurgePremiumSubscription ¶
func (c *Client) PurgePremiumSubscription(ctx context.Context, args map[string]string) (res *sms.PurgeSubResponse, err error)
Delete a Premium SMS Subscription Payload attributes `p *PurgeSubPayload` passed as key value args.
func (*Client) QueuedCall ¶
func (c *Client) QueuedCall(ctx context.Context, args map[string]string) (res *voice.QueuedStatusResult, err error)
Used when you have more calls than you can handle africastalking one time. Payload attributes `p *QueuedCallsPayload` passed as key value args.
func (*Client) Record ¶
Record a calls session into an mp3 file. Payload attributes `p *RecordPayload` passed as key value args.
func (*Client) Redirect ¶
Transfer control of the calls to the script whose URL is passed in. Payload attributes `p *RedirectPayload` passed as key value args.
func (*Client) Reject ¶
Reject an incoming calls without incurring any usage charges. Payload attributes `p *RejectPayload` passed as key value args.
func (*Client) Say ¶
Set a text to be read out to the caller. Payload attributes `p *SayPayload` passed as key value args.
func (*Client) SendAirtime ¶
func (c *Client) SendAirtime(ctx context.Context, args map[string]string) (res *airtyme.AirtimeResponse, err error)
Send Airtime. Payload attributes `p *airtyme.AirtimePayload` passed as key value args.
func (*Client) SendBulkSMS ¶
func (c *Client) SendBulkSMS(ctx context.Context, args map[string]string) (res *sms.BulkResponse, err error)
Send Bulk SMS Payload attributes `p *BulkPayload` passed as key value args.
func (*Client) SendPremiumSMS ¶
func (c *Client) SendPremiumSMS(ctx context.Context, args map[string]string) (res *sms.PremiumSMSResponse, err error)
Send Premium SMS Payload attributes `p *PremiumPayload` passed as key value args.
func (*Client) TopupStash ¶
func (c *Client) TopupStash(ctx context.Context, p *pay.TopupStashPayload) (res *pay.TopupStashResponse, err error)
Move money from a Payment Product to an application stash. An application stash is the wallet that funds your service usage expenses.
func (*Client) TransferCall ¶
func (c *Client) TransferCall(ctx context.Context, args map[string]string) (res *voice.CallTransferResponse, err error)
Transfers calls to another number. Payload attributes `p *CallTransferPayload` passed as key value args.
func (*Client) UploadMedia ¶
Uploads media or audio files to Africa'sTalking servers with the extension .mp3 or .wav Payload attributes `p *UploadMediaFile` passed as key value args.
func (*Client) WalletTransfer ¶
func (c *Client) WalletTransfer(ctx context.Context, p *pay.WalletTransferPayload) (res *pay.WalletTransferResponse, err error)
Transfer money from one Payment Product to another Payment Product hosted on Africa’s Talking.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response `json:"-"` Name string `json:"name"` DebugID string `json:"debug_id"` Message string `json:"message"` InformationLink string `json:"information_link"` Details []ErrorResponseDetail `json:"details"` }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Error method implementation for ErrorResponse struct