Charge Card

{{URL}}/api/cps/v1/chargeCard

CARD PAYMENT METHOD

The CARD payment method allows users to make payments using credit/debit cards. The following steps outline the process:

  • 1
    Call the Create Payment endpoint to initiate a payment transaction.
  • 2
    Encrypt the chargeCard payload with the rexpay public key and call the Charge Card endpoint with the encrypted payload.
  • 3
    Decrypt the response from the Charge Card endpoint using your privateKey generated.
  • 4
    Based on the responseCode of the Charge Card endpoint:
  • 5
    If 00: Transaction Successful.
  • 6
    If TO: Call Authorize Card endpoint to finalize the transaction.
  • 7
    If SO: A redirect link and HTTP method is part of the response which must be triggered to fill in the necessary data.
  • 8
    Call the Get Transaction Status endpoint to check the status of the transaction.

Object Parameters

NameTypeDescriptionOptional Mandatory
referenceStringreference generated on createPaymenttrue
amountNumberTransaction Amounttrue
customerIdStringIdentity number of customertrue
cardDetailsObjectDetails of the card for paymenttrue

Object to encrypt

{
  "reference" : "(reference generated on createPayment",
  "amount" : "100",
  "customerId" : "tname@gmail.com",
  "cardDetails" : {
    "authDataVersion" : "1",
    "pan" : "5976222222299999",
    "expiryDate" : "1230",
    "cvv2" : "456",
    "pin" : "4178"
  }
}

AUTHORIZATION

UsernamePassword
Username{{USERNAME}}
Password{{SECRETKEY}}

BODY PARAMS

{
    "encryptedRequest": "-----BEGIN PGP MESSAGE-----
Version: Didisoft OpenPGP Library for Java 3.2

hIwDT9UVaCho7XYBA/9W5WiA9I4mQ67igGjKuvVRhbZojqhNKE6S0dXU3HC8BmOm
j6LrdLsAe5bhILhPRRf2xl/oaODWy4dUf7Sstx8gcMJhJuvmpYLX6OiYjhhBTK+i
mthv+njBLkOdK/0/Ugf+nY/+12IAi/u+Z8/yl17ye5aHLEVHl2vKGPAcSACX39LA
OQHGM9z6ccc0n3idnZRMdqb5qkkpsy3InbWzSSzf/WK0Ad7Cc+ASz22OaSfC5Eux
jmp7Dblseoif00XWDM6izeeo/DC2Z79oJaeQ+yezIBtZcyTurU1kQtz0UYgsgofY
phzHCFg0POQVLP7PYve2G8OAx+M7O8bra3TzZQhiQVCBMP3nt/YuWHEAoqOX8QbB
xcQs9EVRpP7HeHmngWSCN1l0qPc8XR50A0RJ/5lnBN4nvRq7eguC4Ad0eF9Frbe2
7fGeR3fCouDjVxHwox0esSR8drVuk2tLOktnUd2LY92mvgcOdrDXkA+tlmkMFUk6
jkU2bfyEf81q9w==
=i9oR
-----END PGP MESSAGE-----
"
}

Request Parameters

NameTypeDescriptionOptional Mandatory
encryptedRequestStringUnique client identification numbertrue
VersionNumberVersion fortrue

Example Request

var myHeaders = new Headers();

var raw = "{
    "encryptedRequest": "-----BEGIN PGP MESSAGE-----\nVersion: Didisoft OpenPGP Library for Java 3.2\n\nhIwDT9UVaCho7XYBA/9W5WiA9I4mQ67igGjKuvVRhbZojqhNKE6S0dXU3HC8BmOm\nj6LrdLsAe5bhILhPRRf2xl/oaODWy4dUf7Sstx8gcMJhJuvmpYLX6OiYjhhBTK+i\nmthv+njBLkOdK/0/Ugf+nY/+12IAi/u+Z8/yl17ye5aHLEVHl2vKGPAcSACX39LA\nOQHGM9z6ccc0n3idnZRMdqb5qkkpsy3InbWzSSzf/WK0Ad7Cc+ASz22OaSfC5Eux\njmp7Dblseoif00XWDM6izeeo/DC2Z79oJaeQ+yezIBtZcyTurU1kQtz0UYgsgofY\nphzHCFg0POQVLP7PYve2G8OAx+M7O8bra3TzZQhiQVCBMP3nt/YuWHEAoqOX8QbB\nxcQs9EVRpP7HeHmngWSCN1l0qPc8XR50A0RJ/5lnBN4nvRq7eguC4Ad0eF9Frbe2\n7fGeR3fCouDjVxHwox0esSR8drVuk2tLOktnUd2LY92mvgcOdrDXkA+tlmkMFUk6\njkU2bfyEf81q9w==\n=i9oR\n-----END PGP MESSAGE-----\n"
}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("{{URL}}/api/cps/v1/chargeCard", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Response Parameters

NameTypeDescriptionOptional Mandatory
referenceStringReference Idtrue
clientIdStringClient Identification numbertrue
paymentUrlStringURL for paymenttrue
statusStringTransaction statustrue
paymentChannelStringChanned of paymenttrue
paymentUrlReferenceStringUnique URL for paymenttrue
externalPaymentReferenceNumberUnique external payment reference numbertrue
feesNumberTransaction charge feetrue
currencyStringTransaction currencytrue

Example Response

{
  "reference": "sm23oyr1122",
  "clientId": "dummy@gmail.com",
  "paymentUrl": "https://checkout-dev.globalaccelerex.com/pay/16965521OQbS4EfoEX",
  "status": "CREATED",
  "paymentChannel": "DEFAULT",
  "paymentUrlReference": "16965521OQbS4EfoEX",
  "externalPaymentReference": "16965521OQbS4EfoEX",
  "fees": 0.03,
  "currency": "NGN"
}

Did you find this page helpful?