RESTAPIs

API Requests

The URL to the API service is either:.
Sandbox => https://safacilpay.com/sandbox/ Live => https://safacilpay.com/rest/

Get started

SAFACIL PAY APIs use REST, authenticate with an access tokens, and return HTTP response codes and responses encoded in JSON.

1. Get client ID and client secret

Safacil Pay integrations use a client ID and client secret to authenticate API calls: To call Safacil pay APIs, you'll exchange your client ID and client secret for an access token. Keep this secret safe.

Get access token => https://safacilpay.com/rest/oauth/CLIENT_ID/CLIENT_SECRET

Response :
          {

             "token": "access_token",
             "message": "successful",
             "expires_in": 59,
             "status": 200
         
          }
      

Sandbox

To start making test transactions, go to the S.C section to obtain your test account.

Create payment

To create and display the payment screen you need to configure the URL below : Access TOKEN, Amount to be paid And ORDER ID

GET Payment => https://safacilpay.com/rest/payment/TOKEN/AMOUNT/ORDER_ID

If successful, you will receive an ID for the transaction in your return URL

Sample return URL : https://returnURL?transactionId=00000000

Create payout

Use the Payouts API to make payments to multiple Safacil Pay recipients. The Payouts API is a fast, convenient way to send commissions, rebates and rewards.

GET Payout => https://safacilpay.com/rest/payout/TOKEN/AMOUNT/PHONE

Response :
        {

           "message": "successful",
           "beneficiary": "50900000000",
           "amount": "10",
           "status": 200,
           "date": 0000-00-00 00:00:00

        }
            

Payment history

To have payment history for a specific transaction, you must specify the transaction ID

GET Payment history => https://safacilpay.com/rest/transaction/TOKEN/TRANSACTION_ID

Response :
          {

             "message": "successful",
             "transactionId": 12345678,
             "orderId": 01230440,
             "payer": 509000000,
             "amount": 55,
             "date": 0000-00-00 00:00:00

          }
            

Generate client ID and client secret

You must have a verified Safacil account then you must activate safacil pay on this account.

Download Template PHP API