Direct charge api
Payfonte Direct Charge API
The Payfonte direct charge API allows you to call some providers API directly from your backend application without using a checkout session. Here is how it works:
Optional
From your infrastructure/application, call our Fetch Provider Payment Properties to get the additional the for the API call.- Make a call to our direct charge API with the payment details
- Once the transaction is complete, We will send a webhook response to your webhook URL.
1. Get Payment Provider Properties [Optional for Some providers]
if you are using a provider that expects some addition properties for a direct call, this API will return what you need to make that decision. Example is Orange Senegal, Pawapay. You can find a list of providers that you need to fetch properties for in the Supported Providers Section. Find a Sample CURL Below to fetch provider properties:
Here is a sample response for pawapay
2. Get all the payment details
First, you need to assemble the payment details. Here are the details you’ll need:
Field | Type | Description | Required |
---|---|---|---|
provider | String [Provider Slug] | This is the Provider we are routing the request to. e.g mtn-momo-ivory-coast | false |
amount | Number | This is the amount to charge the customer. This should be in the lowest currency denomination | false |
reference | String | A reference code you’ll generate to identify this transaction. This must be unique for every transaction. If you don’t pass one, we will generate one for you. | False |
redirectURL | String | The URL to which the customer should be redirected after the payment is completed. | False |
webhook | String | This is a URL, if this is passed we will send the event webhook payload to this endpoint | |
customerInput | Object | This is an object of inputs to be passed to the provider. This varies per provider. You can find more in the Examples Section. | True |
narration | String | This is the transaction description | False |
3. Call the endpoint to initialize the Direct Charge
Next, in order to initiate the payment process, you will need to call our Direct Charge API API and provide the collected payment details. Please ensure that you authorize the API call using your client-id and client-secret. Below is an example in CURL:
After making the API call, you will receive a response similar to this:
4. After the payment
This following event will occur after a payment is completed
- If you have webhooks enabled, we will send you a notification via webhook once the payment is completed. To learn more about webhooks and see examples, please visit the following link Webhooks.