Skip to main content

Standard Payments

Initiate a payment

POST /transaction/initialize

For most use cases, this is where the payment journey begins. Need to collect a payment from a customer? Submit the customer and order details, and we'll return a link to a secure prebuilt payment page hosted on Credo that you can redirect your customer to for them to make payment.

Request Parameters

ParamRequiredDescription
api-public-keyYesYour public key. Use test key for test mode and live key for live mode
emailYesEmail address of customer
amountYesAmount (in the lowest currency value - kobo, pesewas or cent) you are debiting customer
referenceNoUnique case-sensitive transaction reference. Only alphanumeric characters are allowed. If you do not pass this parameter, Credo will generate a unique reference.
currencyNoCurrency charge should be performed. Allowed values are NGN or USD. It defaults to your integration currency.
channelsNoAn array of payment channels to control what channels you want to make available to the user to make a payment with. Available channels include; ['card', 'bank']
metadataNoObject containing any extra information you want to be recorded with the transaction. Fields within the custom_field object will appear on merchant receipts and within the transaction information on the Credo Dashboard.
callbackUrlNoAfter a payment attempt, we'll redirect the customer to this URL
serviceCodeNoDynamic settlement service code
customerFirstNameNoCustomer's first name
customerLastNameNoCustomer's last name
customerPhoneNumberNoCustomer's phone number
bearerNo0 = Customer bears fee; 1 = Merchant bears fee

Example requests

const inputBody = {
"amount": 15000,
"bearer": 0,
"callbackUrl": "https://example.com/",
"channels": [“card”, “bank”],
"currency": "NGN",
"customerFirstName": "John",
"customerLastName": "Wick",
"customerPhoneNumber": "2348032132100",
"email": "john.wick@credocentral.com",
"metadata": {
"bankAccount": "0114877128",
"customFields":[ {"variable_name": "gender", "value": "Male", "display_name": "Gender" } ]
},
"//reference": "mTL022NzzQ0 - This must be Unique, if not present we will generate one",
"//serviceCode": "201220045mG7mTL022zQ09 - If you have dynamic settlement service setup"
}
const headers = {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: 'Public Key',
}

const url = 'https://api.credocentral.com/transaction/initialize'
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(inputBody),
})
.then((res) => res.json())
.then(console.log)

Response Parameters

ParamDescription
statusResponse status of the request
messageResponse message describing the status of the request
data.authorizationUrlThis field holds a specialized link to process the initialized payment
data.referenceUnique case-sensitive transaction reference sent with the request or generated by Credo.
data.credoReferenceCredo internal Unique case-sensitive transaction reference
execTimeTime it took to process this request
errorValidation error message if any

Example responses

{
"status": 200,
"message": "Successfully processed",
"data": {
"authorizationUrl": "https://www.credodemo.com/checkout/Sfhx00BA4801Zk1T47wf",
"reference": "201220045mG7mTL022zQ09",
"credoReference": "Sfhx00BA4801Zk1T47wf"
},
"execTime": 4.64879297,
"error": []
}

Redirect after successful payment

callbackUrl?status=0&errorMessage=Approved&transRef=Sfhx00BA4801Zk1T47wf&transAmou
nt=150.00&currency=NGN&reference=201220045mG7mTL022zQ09

Verify payment status

GET /transaction/{transRef}/verify

Use this endpoint to verify the status of a payment transaction. Calling this endpoint will return transaction details for the provided transRef for each transaction.

Path: /transaction/{transRef}/verify

Request Type: GET

Header: Authorization: api-secret-key

Content-Type: application/JSON

Request Headers

ParamRequiredDescription
api-secret-keyYesYour secret key. Use the test key for test mode and the live key for live mode
transRefYesTransaction reference from the business or Credo.

Example requests

const headers = {
Accept: 'application/json',
Authorization: 'api-secret-key',
}

const url = 'https://api.credocentral.com/transaction/{transRef}/verify'
fetch(url, {
method: 'GET',
headers: headers,
})
.then((res) => res.json())
.then(console.log)

Response Parameters

ParamDescription
data.businessCodeBusiness unique identification number within our platform
data.businessRefUnique case-sensitive transaction reference. Only alphanumeric characters are allowed. If you do not pass this parameter, Credo will generate a unique reference.
data.channelIdCredo’s internal channel ID
data.currencyCodeCurrency charge should be performed. Allowed values are NGN or USD. It defaults to your integration currency.
data.customerIdCustomer email during transaction initialization
data.debitedAmountTotal amount that was debited from the customer
data.metadataObject containing any extra information you want to be recorded with the transaction. Fields within the custom_field object will appear on merchant receipts and within the transaction information on the Credo Dashboard.
data.serviceCodeDynamic settlement service code
data.settlementAmountAmount that will be settled to business
data.statusTransaction status - see page 3
data.transAmountRequested/actual transaction amount
data.transFeeAmountTransaction fee
data.transRefCredo internal Unique case-sensitive transaction reference
data.transactionDateTransaction processed date
errorValidation error message if any
execTimeTime it took to process this request
messageResponse message describing the status of the request
statusResponse status of the request

Example responses

{
"status": 200,
"message": "Successfully processed",
"data": {
"businessCode": "700607001390003",
"transRef": "JunW00GkHm01vo0N96pk",
"businessRef": "201220045mG7mTL022zQ09",
"debitedAmount": 15325.0,
"transAmount": 15000.0,
"transFeeAmount": 325.0,
"settlementAmount": 15000.0,
"customerId": "john.wick@credocentral.com",
"transactionDate": "2023-01-04 21:59:10",
"channelId": 0,
"currencyCode": "NGN",
"status": 0,
"metadata": [
{
"insightTag": "bankAccount",
"insightTagValue": "0114877128"
},
{
"insightTag": "gender",
"insightTagValue": "Male",
"insightTagDisplay": "Gender"
}
]
},
"execTime": 0.0
}