CardCharge class enables you to process payments from various card types including Mastercard, Verve, Visa, and international cards. The library supports both PIN-based and redirect-based authentication flows.
Supported Card Types
- Mastercard & Verve: PIN-based authentication
- Visa (Local): Redirect-based authentication
- International Cards: Redirect-based authentication
Setting Up a Card Charge
Use the fluent API to configure your card charge:The card number
The card CVV/CVC code
Card expiry month (e.g., “09”)
Card expiry year (e.g., “19”)
Transaction amount
Customer’s email address
Your unique transaction reference
Currency code (defaults to NGN)
Country code (defaults to NG)
Customer’s card PIN (required for Mastercard/Verve)
Suggested authentication method (e.g., “PIN”)
Redirect URL for Visa/International cards
Device fingerprint for fraud detection (optional)
Charging Methods
Mastercard & Verve Cards
Use thechargeMasterAndVerveCard() method for Mastercard and Verve cards with PIN authentication:
For Mastercard and Verve cards, you must provide the customer’s PIN and set
suggested_auth to “PIN”.Polling for Timeout
If the charge request times out, use the polling variant:Visa & International Cards
Use thechargeVisaAndIntl() method for Visa and international cards with redirect authentication:
For Visa and international cards, you must provide a
redirect_url where users will complete their authentication.Polling for Timeout
Validation Methods
PIN Validation (Mastercard & Verve)
After initiating a charge, validate it using the OTP sent to the customer:Polling for Timeout
Redirect Validation (Visa & International)
For redirect-based authentication, open the auth URL returned in the charge response:Authentication Flows
- PIN Authentication
- Redirect Authentication
Used for Mastercard and Verve cards:
- Customer provides card details and PIN
- System sends charge request with PIN and
suggested_auth: "PIN" - Customer receives OTP
- Validate with OTP to complete transaction
"PIN"Complete Example
Method Reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
chargeMasterAndVerveCard() | - | JSONObject | Charges Mastercard and Verve cards with PIN |
chargeMasterAndVerveCard(boolean polling) | polling | JSONObject | Charges with polling for timeout |
chargeVisaAndIntl() | - | JSONObject | Charges Visa and international cards |
chargeVisaAndIntl(boolean polling) | polling | JSONObject | Charges with polling for timeout |
validateCardCharge() | - | JSONObject | Validates Mastercard/Verve charge with OTP |
validateCardCharge(boolean polling) | polling | JSONObject | Validates with polling for timeout |
validateCardChargeVB() | - | void | Opens browser for redirect validation |
Next Steps
Account Payments
Learn how to charge customer bank accounts
Preauthorization
Hold funds with pre-authorization