@grtsnx/payba3 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CODE_OF_CONDUCT.md +24 -0
  3. package/CONTRIBUTING.md +149 -0
  4. package/LICENSE +21 -0
  5. package/README.md +282 -0
  6. package/SECURITY.md +53 -0
  7. package/SUPPORT.md +27 -0
  8. package/assets/payba3-logo.svg +17 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +24 -0
  11. package/dist/lib/lib.module.d.ts +2 -0
  12. package/dist/lib/lib.module.js +37 -0
  13. package/dist/lib/lib.module.js.map +1 -0
  14. package/dist/lib/monnify/config/monnify.helper.d.ts +24 -0
  15. package/dist/lib/monnify/config/monnify.helper.js +234 -0
  16. package/dist/lib/monnify/config/monnify.helper.js.map +1 -0
  17. package/dist/lib/monnify/config/monnify.types.d.ts +93 -0
  18. package/dist/lib/monnify/config/monnify.types.js +3 -0
  19. package/dist/lib/monnify/config/monnify.types.js.map +1 -0
  20. package/dist/lib/monnify/monnify.module.d.ts +2 -0
  21. package/dist/lib/monnify/monnify.module.js +22 -0
  22. package/dist/lib/monnify/monnify.module.js.map +1 -0
  23. package/dist/lib/monnify/monnify.service.d.ts +19 -0
  24. package/dist/lib/monnify/monnify.service.js +113 -0
  25. package/dist/lib/monnify/monnify.service.js.map +1 -0
  26. package/dist/lib/mono/config/mono.helper.d.ts +11 -0
  27. package/dist/lib/mono/config/mono.helper.js +78 -0
  28. package/dist/lib/mono/config/mono.helper.js.map +1 -0
  29. package/dist/lib/mono/config/mono.types.d.ts +48 -0
  30. package/dist/lib/mono/config/mono.types.js +3 -0
  31. package/dist/lib/mono/config/mono.types.js.map +1 -0
  32. package/dist/lib/mono/mono.module.d.ts +2 -0
  33. package/dist/lib/mono/mono.module.js +22 -0
  34. package/dist/lib/mono/mono.module.js.map +1 -0
  35. package/dist/lib/mono/mono.service.d.ts +15 -0
  36. package/dist/lib/mono/mono.service.js +77 -0
  37. package/dist/lib/mono/mono.service.js.map +1 -0
  38. package/dist/lib/opay/config/opay.helper.d.ts +17 -0
  39. package/dist/lib/opay/config/opay.helper.js +175 -0
  40. package/dist/lib/opay/config/opay.helper.js.map +1 -0
  41. package/dist/lib/opay/config/opay.types.d.ts +73 -0
  42. package/dist/lib/opay/config/opay.types.js +3 -0
  43. package/dist/lib/opay/config/opay.types.js.map +1 -0
  44. package/dist/lib/opay/opay.module.d.ts +2 -0
  45. package/dist/lib/opay/opay.module.js +22 -0
  46. package/dist/lib/opay/opay.module.js.map +1 -0
  47. package/dist/lib/opay/opay.service.d.ts +17 -0
  48. package/dist/lib/opay/opay.service.js +104 -0
  49. package/dist/lib/opay/opay.service.js.map +1 -0
  50. package/dist/lib/payba3.service.d.ts +16 -0
  51. package/dist/lib/payba3.service.js +59 -0
  52. package/dist/lib/payba3.service.js.map +1 -0
  53. package/dist/lib/payba3.types.d.ts +18 -0
  54. package/dist/lib/payba3.types.js +13 -0
  55. package/dist/lib/payba3.types.js.map +1 -0
  56. package/dist/lib/paystack/config/paystack.helper.d.ts +15 -0
  57. package/dist/lib/paystack/config/paystack.helper.js +134 -0
  58. package/dist/lib/paystack/config/paystack.helper.js.map +1 -0
  59. package/dist/lib/paystack/config/paystack.types.d.ts +92 -0
  60. package/dist/lib/paystack/config/paystack.types.js +3 -0
  61. package/dist/lib/paystack/config/paystack.types.js.map +1 -0
  62. package/dist/lib/paystack/paystack.module.d.ts +2 -0
  63. package/dist/lib/paystack/paystack.module.js +22 -0
  64. package/dist/lib/paystack/paystack.module.js.map +1 -0
  65. package/dist/lib/paystack/paystack.service.d.ts +33 -0
  66. package/dist/lib/paystack/paystack.service.js +328 -0
  67. package/dist/lib/paystack/paystack.service.js.map +1 -0
  68. package/dist/lib/qoreid/config/qoreid.helper.d.ts +19 -0
  69. package/dist/lib/qoreid/config/qoreid.helper.js +132 -0
  70. package/dist/lib/qoreid/config/qoreid.helper.js.map +1 -0
  71. package/dist/lib/qoreid/config/qoreid.types.d.ts +35 -0
  72. package/dist/lib/qoreid/config/qoreid.types.js +3 -0
  73. package/dist/lib/qoreid/config/qoreid.types.js.map +1 -0
  74. package/dist/lib/qoreid/qoreid.module.d.ts +2 -0
  75. package/dist/lib/qoreid/qoreid.module.js +22 -0
  76. package/dist/lib/qoreid/qoreid.module.js.map +1 -0
  77. package/dist/lib/qoreid/qoreid.service.d.ts +10 -0
  78. package/dist/lib/qoreid/qoreid.service.js +63 -0
  79. package/dist/lib/qoreid/qoreid.service.js.map +1 -0
  80. package/dist/lib/safehaven/config/safe.helper.d.ts +16 -0
  81. package/dist/lib/safehaven/config/safe.helper.js +136 -0
  82. package/dist/lib/safehaven/config/safe.helper.js.map +1 -0
  83. package/dist/lib/safehaven/config/safe.types.d.ts +50 -0
  84. package/dist/lib/safehaven/config/safe.types.js +3 -0
  85. package/dist/lib/safehaven/config/safe.types.js.map +1 -0
  86. package/dist/lib/safehaven/safe.module.d.ts +2 -0
  87. package/dist/lib/safehaven/safe.module.js +22 -0
  88. package/dist/lib/safehaven/safe.module.js.map +1 -0
  89. package/dist/lib/safehaven/safe.service.d.ts +14 -0
  90. package/dist/lib/safehaven/safe.service.js +77 -0
  91. package/dist/lib/safehaven/safe.service.js.map +1 -0
  92. package/dist/lib/seerbit/config/seerbit.helper.d.ts +11 -0
  93. package/dist/lib/seerbit/config/seerbit.helper.js +88 -0
  94. package/dist/lib/seerbit/config/seerbit.helper.js.map +1 -0
  95. package/dist/lib/seerbit/config/seerbit.types.d.ts +49 -0
  96. package/dist/lib/seerbit/config/seerbit.types.js +3 -0
  97. package/dist/lib/seerbit/config/seerbit.types.js.map +1 -0
  98. package/dist/lib/seerbit/seerbit.module.d.ts +2 -0
  99. package/dist/lib/seerbit/seerbit.module.js +22 -0
  100. package/dist/lib/seerbit/seerbit.module.js.map +1 -0
  101. package/dist/lib/seerbit/seerbit.service.d.ts +11 -0
  102. package/dist/lib/seerbit/seerbit.service.js +83 -0
  103. package/dist/lib/seerbit/seerbit.service.js.map +1 -0
  104. package/dist/lib/shared/index.d.ts +1 -0
  105. package/dist/lib/shared/index.js +18 -0
  106. package/dist/lib/shared/index.js.map +1 -0
  107. package/dist/lib/shared/response.helper.d.ts +15 -0
  108. package/dist/lib/shared/response.helper.js +39 -0
  109. package/dist/lib/shared/response.helper.js.map +1 -0
  110. package/llms.txt +25 -0
  111. package/package.json +169 -0
  112. package/src/lib/monnify/monnify_llm.txt +429 -0
  113. package/src/lib/mono/mono_llm.txt +372 -0
  114. package/src/lib/opay/opay_llm.txt +1022 -0
  115. package/src/lib/paystack/paystack_llm.txt +382 -0
  116. package/src/lib/qoreid/qoreid_llm.txt +68 -0
  117. package/src/lib/safehaven/safehaven_llm.txt +77 -0
  118. package/src/lib/seerbit/seerbit_llm.txt +61 -0
@@ -0,0 +1,1022 @@
1
+ # OPay
2
+
3
+ > OPay is a leading Nigerian fintech company providing secure, PCI-compliant RESTful payment APIs for accepting and processing payments. OPay offers multiple payment methods including card payments (3DS), bank transfers, USSD, bank account debits, OPay wallet, and reference code payments. The platform operates in Nigeria and Egypt, supporting NGN and USD currencies.
4
+
5
+ OPay provides comprehensive payment solutions for merchants through:
6
+ - **Express Checkout**: Hosted payment page (OPay Cashier) for seamless integration
7
+ - **Server-Side APIs**: Full control over checkout UI/UX with direct API integration
8
+ - **Mobile SDKs**: Native SDKs for Android, iOS, Flutter, and React Native
9
+ - **E-Commerce Plugins**: Ready-made plugins for WooCommerce, Shopify, Magento
10
+
11
+ Key Integration Notes:
12
+ - All API requests must be made over HTTPS
13
+ - Authentication uses Public Key bearer auth for cashier creation, HMAC-SHA512 signatures for signed API calls, and HMAC-SHA3-512 for callback verification
14
+ - Amounts are in minor units (100 kobos = 1 NGN, 100 cents = 1 USD)
15
+ - Sandbox environment available for testing before production
16
+ - Webhooks provide real-time transaction status updates
17
+
18
+ ## Docs
19
+
20
+ - [OPay Documentation Home](https://documentation.opaycheckout.com): Main developer documentation portal with guides and API references
21
+ - [Getting Started](https://documentation.opaycheckout.com/getting-started): Account registration and merchant dashboard setup guide
22
+ - [Payment Authentication](https://documentation.opaycheckout.com/payment-authentication): API keys, public key auth, and signature authentication methods
23
+ - [API Signature Calculator](https://documentation.opaycheckout.com/api-signature): HMAC-SHA512 signature generation for API calls
24
+ - [Callback Signature](https://documentation.opaycheckout.com/callback-signature): Verifying webhook notification signatures
25
+ - [Regional Payment Methods](https://documentation.opaycheckout.com/regional-payment-methods): Supported countries, currencies, and payment methods
26
+ - [Error Codes](https://documentation.opaycheckout.com/error-codes): Complete list of OPay and acquirer bank error codes
27
+ - [End to End Testing](https://documentation.opaycheckout.com/end-to-end-testing): Sandbox test cards and test data for all payment methods
28
+
29
+ ## Express Checkout
30
+
31
+ - [Express Checkout Overview](https://documentation.opaycheckout.com/checkout-overview): OPay Cashier hosted payment page integration guide
32
+ - [Cashier Create Payment](https://documentation.opaycheckout.com/cashier-create): API to create payment sessions and redirect to OPay Cashier
33
+
34
+ ## Server Side APIs
35
+
36
+ - [Server APIs Overview](https://documentation.opaycheckout.com/server-apis-overview): Introduction to building custom checkout with server-to-server APIs
37
+ - [3DS Card Payment](https://documentation.opaycheckout.com/3DS-API): 3D Secure card payment integration with redirect flow
38
+ - [Bank Transfer Payment](https://documentation.opaycheckout.com/bank-transfer): Generate virtual account for bank transfer payments
39
+ - [Bank USSD Payment](https://documentation.opaycheckout.com/bank-Ussd): USSD-based payment integration
40
+ - [Bank Account Payment](https://documentation.opaycheckout.com/bank-account): Direct bank account debit with OTP/3DS verification
41
+ - [POS Payment](https://documentation.opaycheckout.com/pos): Point of Sale terminal payment integration
42
+ - [Reference Code Payment](https://documentation.opaycheckout.com/reference-code): Generate reference codes for offline payments
43
+ - [OPay Wallet QR Payment](https://documentation.opaycheckout.com/opay-wallet-payment): QR code payment via OPay Wallet
44
+ - [Query Payment Status](https://documentation.opaycheckout.com/query-payment-status): Retrieve payment transaction status
45
+ - [Cancel Payment](https://documentation.opaycheckout.com/cashier-close): Cancel pending payment transactions
46
+ - [Refund Payment](https://documentation.opaycheckout.com/payment-refund): Process full or partial refunds
47
+ - [Query Refund Status](https://documentation.opaycheckout.com/payment-refund-status): Check refund transaction status
48
+ - [Send OTP](https://documentation.opaycheckout.com/send-otp): Trigger OTP for payment verification
49
+ - [Input OTP](https://documentation.opaycheckout.com/input-otp): Submit OTP for payment authorization
50
+ - [Input PIN](https://documentation.opaycheckout.com/input-pin): Submit PIN for payment authorization
51
+
52
+ ## Mobile SDKs
53
+
54
+ - [Android SDK](https://documentation.opaycheckout.com/android-sdk): Native Android SDK integration guide with Java/Kotlin examples
55
+ - [iOS SDK](https://documentation.opaycheckout.com/ios-sdk): Native iOS SDK integration guide
56
+ - [Flutter SDK](https://documentation.opaycheckout.com/flutter-sdk): Flutter plugin for cross-platform mobile apps
57
+ - [React Native SDK](https://documentation.opaycheckout.com/react-native-sdk): React Native module for mobile apps
58
+
59
+ ## Webhooks
60
+
61
+ - [Payment Notifications Callbacks](https://documentation.opaycheckout.com/payment-notifications-callbacks): Setting up webhook endpoints for transaction status updates
62
+
63
+ ## E-Commerce Plugins
64
+
65
+ - [WooCommerce Plugin](https://documentation.opaycheckout.com/woocommerce-plugin): WordPress/WooCommerce payment gateway plugin
66
+
67
+ ## Offline Payments
68
+
69
+ - [Offline Payments Overview](https://documentation.opayweb.com/doc/offline/overview.html): POS and offline payment integration documentation
70
+ - [Offline API Basics](https://documentation.opayweb.com/doc/offline/api-basics.html): Request methods, common parameters, and response codes
71
+ - [Offline Authentication](https://documentation.opayweb.com/doc/offline/authentication.html): RSA encryption and signing for offline APIs
72
+ - [POS Integration API](https://documentation.opayweb.com/doc/offline/pos-api.html): API-based POS terminal integration
73
+ - [Query Balance](https://documentation.opayweb.com/doc/offline/query-account-balance.html): Check merchant account balance
74
+
75
+ ## Optional
76
+
77
+ - [OPay Merchant Dashboard](https://merchant.opaycheckout.com): Merchant portal for account management and API keys
78
+ - [OPay Support](https://support.opaycheckout.com/support/ticket): Contact OPay support team
79
+ - [OPay Website](https://opayweb.com): Main OPay corporate website
80
+
81
+ ---
82
+
83
+ # API Reference
84
+
85
+ > Complete API reference for OPay payment gateway integration. OPay provides RESTful APIs for accepting payments via cards, bank transfers, USSD, bank accounts, OPay wallet, and reference codes. All APIs use JSON format, HTTPS, and support both sandbox and production environments.
86
+
87
+ ## API Environments
88
+
89
+ | Environment | Base URL |
90
+ |-------------|----------|
91
+ | Sandbox (Testing) | `https://testapi.opaycheckout.com` |
92
+ | Production (Live) | `https://liveapi.opaycheckout.com` |
93
+ | Offline Payments | `https://payapi.opayweb.com` |
94
+
95
+ ## Authentication
96
+
97
+ OPay uses two authentication methods depending on the API endpoint:
98
+
99
+ ### 1. Public Key Authentication
100
+ Used for: Cashier Create Payment API
101
+
102
+ ```
103
+ Authorization: Bearer {PublicKey}
104
+ MerchantId: {YourMerchantId}
105
+ ```
106
+
107
+ ### 2. Signature Authentication (HMAC-SHA512)
108
+ Used for: All other payment APIs (status queries, refunds, server-side payments)
109
+
110
+ ```
111
+ Authorization: Bearer {HMAC-SHA512-Signature}
112
+ MerchantId: {YourMerchantId}
113
+ ```
114
+
115
+ **Signature Generation:**
116
+ 1. Create JSON payload with alphabetically sorted keys
117
+ 2. Compute HMAC-SHA512 of the JSON string using your Secret Key
118
+ 3. Use the hex-encoded result as the signature
119
+
120
+ **PHP Example:**
121
+ ```php
122
+ $signature = hash_hmac('sha512', json_encode($data), $secretKey);
123
+ ```
124
+
125
+ **JavaScript Example:**
126
+ ```javascript
127
+ const crypto = require('crypto');
128
+ const signature = crypto.createHmac('sha512', secretKey)
129
+ .update(JSON.stringify(data))
130
+ .digest('hex');
131
+ ```
132
+
133
+ **Java Example:**
134
+ ```java
135
+ Mac mac = Mac.getInstance("HmacSHA512");
136
+ SecretKeySpec secretKey = new SecretKeySpec(privateKey.getBytes(), "HmacSHA512");
137
+ mac.init(secretKey);
138
+ byte[] hmacData = mac.doFinal(jsonPayload.getBytes());
139
+ String signature = Hex.encodeHexString(hmacData);
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Express Checkout API
145
+
146
+ ### Create Cashier Payment
147
+
148
+ Creates a payment session and returns a URL to redirect customers to OPay's hosted checkout page.
149
+
150
+ **Endpoint:** `POST /api/v1/international/cashier/create`
151
+
152
+ **Authentication:** Public Key
153
+
154
+ **Request Headers:**
155
+ ```
156
+ Content-Type: application/json
157
+ Authorization: Bearer {PublicKey}
158
+ MerchantId: {YourMerchantId}
159
+ ```
160
+
161
+ **Request Body:**
162
+ ```json
163
+ {
164
+ "reference": "unique-order-123",
165
+ "country": "NG",
166
+ "amount": {
167
+ "total": 10000,
168
+ "currency": "NGN"
169
+ },
170
+ "product": {
171
+ "name": "Product Name",
172
+ "description": "Product description"
173
+ },
174
+ "returnUrl": "https://yoursite.com/payment/success",
175
+ "callbackUrl": "https://yoursite.com/webhook/opay",
176
+ "cancelUrl": "https://yoursite.com/payment/cancelled",
177
+ "payMethod": "BankCard",
178
+ "expireAt": 30,
179
+ "userInfo": {
180
+ "userId": "user123",
181
+ "userName": "John Doe",
182
+ "userEmail": "john@example.com",
183
+ "userMobile": "+2348012345678"
184
+ }
185
+ }
186
+ ```
187
+
188
+ **Request Parameters:**
189
+
190
+ | Parameter | Type | Required | Description |
191
+ |-----------|------|----------|-------------|
192
+ | reference | String | Yes | Unique merchant order number |
193
+ | country | String | Yes | Country code: `NG` (Nigeria) |
194
+ | amount.total | Integer | Yes | Amount in minor units (kobos) |
195
+ | amount.currency | String | Yes | Currency: `NGN` or `USD` |
196
+ | product.name | String | Yes | Product name |
197
+ | product.description | String | Yes | Product description |
198
+ | returnUrl | String | Yes | Redirect URL after payment completion |
199
+ | callbackUrl | String | No | Webhook URL for payment notifications |
200
+ | cancelUrl | String | No | Redirect URL if payment cancelled |
201
+ | payMethod | String | No | Preferred payment method (see Payment Methods) |
202
+ | expireAt | Integer | No | Expiration time in minutes (default: 30) |
203
+ | userInfo.userId | String | No | Customer user ID |
204
+ | userInfo.userName | String | No | Customer name |
205
+ | userInfo.userEmail | String | No | Customer email |
206
+ | userInfo.userMobile | String | No | Customer phone |
207
+ | displayName | String | No | Sub-merchant name to display |
208
+ | evokeOpay | Boolean | No | Whether to open OPay app for payment |
209
+ | customerVisitSource | String | No | `IOS`, `ANDROID`, or `BROWSER` |
210
+
211
+ **Success Response:**
212
+ ```json
213
+ {
214
+ "code": "00000",
215
+ "message": "SUCCESSFUL",
216
+ "data": {
217
+ "reference": "unique-order-123",
218
+ "orderNo": "211009140896553163",
219
+ "cashierUrl": "https://sandboxcashier.opaycheckout.com/...",
220
+ "status": "INITIAL",
221
+ "amount": {
222
+ "total": 10000,
223
+ "currency": "NGN"
224
+ },
225
+ "vat": {
226
+ "total": 0,
227
+ "currency": "NGN"
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Server-Side Payment APIs
236
+
237
+ ### 3DS Card Payment
238
+
239
+ Process card payments with 3D Secure authentication.
240
+
241
+ **Endpoint:** `POST /api/v1/international/payment/create`
242
+
243
+ **Authentication:** Signature (HMAC-SHA512)
244
+
245
+ **Request Body:**
246
+ ```json
247
+ {
248
+ "reference": "order-456",
249
+ "country": "NG",
250
+ "amount": {
251
+ "total": 50000,
252
+ "currency": "NGN"
253
+ },
254
+ "bankcard": {
255
+ "cardNumber": "5061460410121111104",
256
+ "expiryMonth": "12",
257
+ "expiryYear": "50",
258
+ "cvv": "560",
259
+ "cardHolderName": "JOHN DOE",
260
+ "enable3DS": true
261
+ },
262
+ "product": {
263
+ "name": "Product Name",
264
+ "description": "Product description"
265
+ },
266
+ "payMethod": "BankCard",
267
+ "returnUrl": "https://yoursite.com/payment/complete",
268
+ "callbackUrl": "https://yoursite.com/webhook/opay"
269
+ }
270
+ ```
271
+
272
+ **Card Parameters:**
273
+
274
+ | Parameter | Type | Required | Description |
275
+ |-----------|------|----------|-------------|
276
+ | bankcard.cardNumber | String | Yes | Card number |
277
+ | bankcard.expiryMonth | String | Yes | Expiry month (01-12) |
278
+ | bankcard.expiryYear | String | Yes | Expiry year (2 digits: 25, 26...) |
279
+ | bankcard.cvv | String | Yes | CVV/CVC code |
280
+ | bankcard.cardHolderName | String | Yes | Cardholder name |
281
+ | bankcard.enable3DS | Boolean | Yes | Must be `true` |
282
+
283
+ **For USD Payments, add billingInfo:**
284
+ ```json
285
+ {
286
+ "billingInfo": {
287
+ "country": "US",
288
+ "postalCode": "10001",
289
+ "state": "New York",
290
+ "city": "New York",
291
+ "address": "123 Main St",
292
+ "firstName": "John",
293
+ "lastName": "Doe",
294
+ "mobileNumber": "+1234567890",
295
+ "email": "john@example.com"
296
+ }
297
+ }
298
+ ```
299
+
300
+ **Success Response:**
301
+ ```json
302
+ {
303
+ "code": "00000",
304
+ "message": "SUCCESSFUL",
305
+ "data": {
306
+ "reference": "order-456",
307
+ "orderNo": "211004140885521681",
308
+ "status": "PENDING",
309
+ "nextAction": {
310
+ "actionType": "REDIRECT_3DS",
311
+ "redirectUrl": "https://testapi.opaycheckout.com/api/v1/international/transaction/3ds/..."
312
+ },
313
+ "amount": {
314
+ "total": 50000,
315
+ "currency": "NGN"
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ ---
322
+
323
+ ### Bank Transfer Payment
324
+
325
+ Generate a virtual bank account for customers to transfer to.
326
+
327
+ **Endpoint:** `POST /api/v1/international/payment/create`
328
+
329
+ **Authentication:** Signature (HMAC-SHA512)
330
+
331
+ **Request Body:**
332
+ ```json
333
+ {
334
+ "reference": "transfer-789",
335
+ "country": "NG",
336
+ "amount": {
337
+ "total": 100000,
338
+ "currency": "NGN"
339
+ },
340
+ "payMethod": "BankTransfer",
341
+ "product": {
342
+ "name": "Product Name",
343
+ "description": "Product description"
344
+ },
345
+ "callbackUrl": "https://yoursite.com/webhook/opay",
346
+ "customerName": "John Doe",
347
+ "userInfo": {
348
+ "userId": "user123",
349
+ "userName": "John Doe",
350
+ "userEmail": "john@example.com",
351
+ "userMobile": "+2348012345678"
352
+ }
353
+ }
354
+ ```
355
+
356
+ **Success Response:**
357
+ ```json
358
+ {
359
+ "code": "00000",
360
+ "message": "SUCCESSFUL",
361
+ "data": {
362
+ "reference": "transfer-789",
363
+ "orderNo": "220110144664537659",
364
+ "status": "PENDING",
365
+ "nextAction": {
366
+ "actionType": "TRANSFER_ACCOUNT",
367
+ "transferAccountNumber": "7827845341",
368
+ "transferBankName": "WEMA BANK",
369
+ "expiredTimestamp": 1641773850
370
+ },
371
+ "amount": {
372
+ "total": 100000,
373
+ "currency": "NGN"
374
+ }
375
+ }
376
+ }
377
+ ```
378
+
379
+ ---
380
+
381
+ ### Bank USSD Payment
382
+
383
+ Initialize USSD-based payment.
384
+
385
+ **Endpoint:** `POST /api/v1/international/payment/create`
386
+
387
+ **Authentication:** Signature (HMAC-SHA512)
388
+
389
+ **Request Body:**
390
+ ```json
391
+ {
392
+ "reference": "ussd-order-123",
393
+ "country": "NG",
394
+ "amount": {
395
+ "total": 25000,
396
+ "currency": "NGN"
397
+ },
398
+ "payMethod": "BankUssd",
399
+ "bankCode": "058",
400
+ "product": {
401
+ "name": "Product Name",
402
+ "description": "Product description"
403
+ },
404
+ "callbackUrl": "https://yoursite.com/webhook/opay"
405
+ }
406
+ ```
407
+
408
+ ---
409
+
410
+ ### Bank Account Payment
411
+
412
+ Direct debit from customer's bank account with OTP/3DS verification.
413
+
414
+ **Endpoint:** `POST /api/v1/international/payment/create`
415
+
416
+ **Authentication:** Signature (HMAC-SHA512)
417
+
418
+ **Request Body:**
419
+ ```json
420
+ {
421
+ "reference": "bank-debit-123",
422
+ "country": "NG",
423
+ "amount": {
424
+ "total": 75000,
425
+ "currency": "NGN"
426
+ },
427
+ "payMethod": "BankAccount",
428
+ "bankAccount": {
429
+ "bankCode": "033",
430
+ "accountNumber": "2215381184",
431
+ "bvn": "123456789",
432
+ "dobDay": "05",
433
+ "dobMonth": "01",
434
+ "dobYear": "1990",
435
+ "phoneNumber": "08012345678"
436
+ },
437
+ "product": {
438
+ "name": "Product Name",
439
+ "description": "Product description"
440
+ },
441
+ "callbackUrl": "https://yoursite.com/webhook/opay"
442
+ }
443
+ ```
444
+
445
+ ---
446
+
447
+ ### Reference Code Payment
448
+
449
+ Generate a reference code for offline/POS payments.
450
+
451
+ **Endpoint:** `POST /api/v1/international/payment/create`
452
+
453
+ **Authentication:** Signature (HMAC-SHA512)
454
+
455
+ **Request Body:**
456
+ ```json
457
+ {
458
+ "reference": "ref-code-123",
459
+ "country": "NG",
460
+ "amount": {
461
+ "total": 50000,
462
+ "currency": "NGN"
463
+ },
464
+ "payMethod": "ReferenceCode",
465
+ "expireAt": 60,
466
+ "product": {
467
+ "name": "Product Name",
468
+ "description": "Product description"
469
+ },
470
+ "callbackUrl": "https://yoursite.com/webhook/opay",
471
+ "userInfo": {
472
+ "userName": "John Doe",
473
+ "userEmail": "john@example.com",
474
+ "userMobile": "+2348012345678"
475
+ }
476
+ }
477
+ ```
478
+
479
+ **Success Response includes:**
480
+ ```json
481
+ {
482
+ "data": {
483
+ "referenceCode": "123456789",
484
+ "orderNo": "220110144664537659"
485
+ }
486
+ }
487
+ ```
488
+
489
+ ---
490
+
491
+ ### OPay Wallet QR Payment
492
+
493
+ Generate QR code for OPay Wallet payments.
494
+
495
+ **Endpoint:** `POST /api/v1/international/payment/create`
496
+
497
+ **Authentication:** Signature (HMAC-SHA512)
498
+
499
+ **Request Body:**
500
+ ```json
501
+ {
502
+ "reference": "qr-payment-123",
503
+ "country": "NG",
504
+ "amount": {
505
+ "total": 30000,
506
+ "currency": "NGN"
507
+ },
508
+ "payMethod": "OpayWalletNgQR",
509
+ "product": {
510
+ "name": "Product Name",
511
+ "description": "Product description"
512
+ },
513
+ "callbackUrl": "https://yoursite.com/webhook/opay"
514
+ }
515
+ ```
516
+
517
+ ---
518
+
519
+ ## Payment Status & Management APIs
520
+
521
+ ### Query Payment Status
522
+
523
+ Retrieve the current status of a payment transaction.
524
+
525
+ **Endpoint:** `POST /api/v1/international/cashier/status`
526
+
527
+ **Authentication:** Signature (HMAC-SHA512)
528
+
529
+ **Request Body:**
530
+ ```json
531
+ {
532
+ "reference": "order-123",
533
+ "country": "NG"
534
+ }
535
+ ```
536
+
537
+ Or query by OPay order number:
538
+ ```json
539
+ {
540
+ "orderNo": "211009140896593010",
541
+ "country": "NG"
542
+ }
543
+ ```
544
+
545
+ **Response:**
546
+ ```json
547
+ {
548
+ "code": "00000",
549
+ "message": "SUCCESSFUL",
550
+ "data": {
551
+ "reference": "order-123",
552
+ "orderNo": "211009140896593010",
553
+ "status": "SUCCESS",
554
+ "amount": {
555
+ "total": 10000,
556
+ "currency": "NGN"
557
+ },
558
+ "vat": {
559
+ "total": 0,
560
+ "currency": "NGN"
561
+ },
562
+ "createTime": 1633788085000
563
+ }
564
+ }
565
+ ```
566
+
567
+ **Payment Status Values:**
568
+
569
+ | Status | Description |
570
+ |--------|-------------|
571
+ | INITIAL | Payment created, awaiting customer action |
572
+ | PENDING | Payment in progress |
573
+ | SUCCESS | Payment completed successfully |
574
+ | FAIL | Payment failed |
575
+ | CLOSE | Payment closed/cancelled |
576
+
577
+ ---
578
+
579
+ ### Cancel Payment
580
+
581
+ Cancel a pending payment transaction.
582
+
583
+ **Endpoint:** `POST /api/v1/international/cashier/close`
584
+
585
+ **Authentication:** Signature (HMAC-SHA512)
586
+
587
+ **Request Body:**
588
+ ```json
589
+ {
590
+ "reference": "order-123",
591
+ "country": "NG"
592
+ }
593
+ ```
594
+
595
+ ---
596
+
597
+ ### Refund Payment
598
+
599
+ Process a refund for a completed payment.
600
+
601
+ **Endpoint:** `POST /api/v1/international/payment/refund/create`
602
+
603
+ **Authentication:** Signature (HMAC-SHA512)
604
+
605
+ **Request Body:**
606
+ ```json
607
+ {
608
+ "reference": "refund-001",
609
+ "originalReference": "order-123",
610
+ "country": "NG",
611
+ "amount": {
612
+ "total": 10000,
613
+ "currency": "NGN"
614
+ },
615
+ "refundWay": "Original",
616
+ "callbackUrl": "https://yoursite.com/webhook/refund",
617
+ "refundReason": "Customer requested refund"
618
+ }
619
+ ```
620
+
621
+ **Refund Ways by Payment Method:**
622
+
623
+ | Payment Method | Refund Way |
624
+ |----------------|------------|
625
+ | BankAccount | Original |
626
+ | BankTransfer | BankAccount |
627
+ | BankUssd | BankAccount |
628
+ | OpayWallet | Original |
629
+ | BankCard | BankAccount |
630
+
631
+ **For BankAccount refunds, add receiver info:**
632
+ ```json
633
+ {
634
+ "receiver": {
635
+ "bankCode": "033",
636
+ "bankAccountNo": "1234567890"
637
+ }
638
+ }
639
+ ```
640
+
641
+ ---
642
+
643
+ ### Query Refund Status
644
+
645
+ Check the status of a refund transaction.
646
+
647
+ **Endpoint:** `POST /api/v1/international/payment/refund/query`
648
+
649
+ **Authentication:** Signature (HMAC-SHA512)
650
+
651
+ **Request Body:**
652
+ ```json
653
+ {
654
+ "reference": "refund-001",
655
+ "country": "NG"
656
+ }
657
+ ```
658
+
659
+ ---
660
+
661
+ ## OTP & PIN Verification APIs
662
+
663
+ ### Send OTP
664
+
665
+ Trigger OTP sending for payment verification.
666
+
667
+ **Endpoint:** `POST /api/v1/international/payment/otp/send`
668
+
669
+ **Authentication:** Signature (HMAC-SHA512)
670
+
671
+ **Request Body:**
672
+ ```json
673
+ {
674
+ "orderNo": "220207140591969743",
675
+ "country": "NG"
676
+ }
677
+ ```
678
+
679
+ ---
680
+
681
+ ### Input OTP
682
+
683
+ Submit OTP for payment authorization.
684
+
685
+ **Endpoint:** `POST /api/v1/international/payment/otp/input`
686
+
687
+ **Authentication:** Signature (HMAC-SHA512)
688
+
689
+ **Request Body:**
690
+ ```json
691
+ {
692
+ "orderNo": "220207140591969743",
693
+ "country": "NG",
694
+ "otp": "123456"
695
+ }
696
+ ```
697
+
698
+ ---
699
+
700
+ ### Input PIN
701
+
702
+ Submit PIN for payment authorization.
703
+
704
+ **Endpoint:** `POST /api/v1/international/payment/pin/input`
705
+
706
+ **Authentication:** Signature (HMAC-SHA512)
707
+
708
+ **Request Body:**
709
+ ```json
710
+ {
711
+ "orderNo": "220207140591969743",
712
+ "country": "NG",
713
+ "pin": "1234"
714
+ }
715
+ ```
716
+
717
+ ---
718
+
719
+ ## Webhook Notifications
720
+
721
+ OPay sends POST requests to your callback URL when transaction status changes.
722
+
723
+ ### Webhook Payload Structure
724
+
725
+ ```json
726
+ {
727
+ "payload": {
728
+ "amount": "49160",
729
+ "channel": "Web",
730
+ "country": "NG",
731
+ "currency": "NGN",
732
+ "displayedFailure": "",
733
+ "fee": "737",
734
+ "feeCurrency": "NGN",
735
+ "instrumentType": "BankCard",
736
+ "reference": "order-123",
737
+ "refunded": false,
738
+ "status": "SUCCESS",
739
+ "timestamp": "2022-05-07T06:20:46Z",
740
+ "token": "220507145660712931829",
741
+ "transactionId": "220507145660712931829",
742
+ "updated_at": "2022-05-07T07:20:46Z"
743
+ },
744
+ "sha512": "9f605d69f04e94172875dc156537071...",
745
+ "type": "transaction-status"
746
+ }
747
+ ```
748
+
749
+ ### Verifying Webhook Signature
750
+
751
+ 1. Extract the `payload` object from the webhook
752
+ 2. Compute HMAC-SHA3-512 of the payload JSON using your Secret Key
753
+ 3. Compare with the `sha512` value in the webhook using a timing-safe comparison
754
+
755
+ ### Webhook Response
756
+
757
+ Respond with HTTP `200 OK` to acknowledge receipt. OPay retries failed webhooks for 72 hours with increasing intervals.
758
+
759
+ ---
760
+
761
+ ## Payment Methods Reference
762
+
763
+ ### Nigeria (NG) - NGN Currency
764
+
765
+ | payMethod Value | Description |
766
+ |-----------------|-------------|
767
+ | BankCard | Visa/Mastercard with 3DS |
768
+ | BankTransfer | Bank transfer to virtual account |
769
+ | BankUssd | USSD payment |
770
+ | BankAccount | Direct bank account debit |
771
+ | OpayWalletNg | OPay Wallet payment |
772
+ | OpayWalletNgQR | OPay Wallet QR code |
773
+ | ReferenceCode | Reference code for POS/offline |
774
+
775
+ ### Nigeria (NG) - USD Currency
776
+
777
+ | payMethod Value | Description |
778
+ |-----------------|-------------|
779
+ | BankCard | International cards with 3DS |
780
+
781
+ ---
782
+
783
+ ## Error Codes
784
+
785
+ ### OPay System Errors
786
+
787
+ | Code | Message |
788
+ |------|---------|
789
+ | 00000 | SUCCESSFUL |
790
+ | 02000 | Authentication failed |
791
+ | 02001 | Request params not valid |
792
+ | 02002 | Merchant not configured with this function |
793
+ | 02003 | payMethod not supported |
794
+ | 02004 | Payment reference already exists |
795
+ | 02006 | Payment not found |
796
+ | 02007 | Merchant not available |
797
+ | 09 | Timeout |
798
+ | 90 | System failure |
799
+ | 91 | Refund error, please try again |
800
+ | 96 | Search order error |
801
+ | 97 | Create checkout session failed |
802
+ | 50003 | Service not available |
803
+
804
+ ### Acquirer Bank Errors
805
+
806
+ | Code | Message |
807
+ |------|---------|
808
+ | 05 | Do not honour |
809
+ | 13 | Invalid amount |
810
+ | 51 | Insufficient funds |
811
+ | 54 | Expired card |
812
+ | 57 | Transaction not permitted |
813
+ | 62 | Restricted card |
814
+
815
+ ---
816
+
817
+ ## Test Cards (Sandbox Only)
818
+
819
+ ### Nigerian Cards (NGN)
820
+
821
+ | Card Number | CVV | Expiry | PIN | OTP | Test Case | Status |
822
+ |-------------|-----|--------|-----|-----|-----------|--------|
823
+ | 5061460410121111104 | 560 | 12/50 | 1104 | 543210 | PIN | SUCCESS |
824
+ | 5061460410121111105 | 561 | 12/50 | 1105 | 543210 | PIN+OTP | SUCCESS |
825
+ | 5061460410121111106 | 562 | 12/50 | 1106 | 543210 | PIN+3DS | SUCCESS |
826
+ | 5061460410121111107 | 563 | 12/50 | 1107 | 123456 | PIN | FAIL |
827
+
828
+ ### International Cards (USD)
829
+
830
+ | Card Number | CVV | Expiry | Test Case | Status |
831
+ |-------------|-----|--------|-----------|--------|
832
+ | 4508750015741019 | 100 | 12/50 | 3DS | SUCCESS |
833
+ | 5123450000000008 | 100 | 12/50 | 3DS | SUCCESS |
834
+ | 2223000000000007 | 100 | 12/50 | 3DS | FAIL |
835
+
836
+ ### Test Bank Account
837
+
838
+ | Bank Code | Account Number | Phone | DOB | BVN | OTP |
839
+ |-----------|----------------|-------|-----|-----|-----|
840
+ | 033 | 2215381184 | 0000000000 | 05-01-1990 | 123456789 | - |
841
+
842
+ ### Test OPay Wallet
843
+
844
+ | Phone Number | PIN | OTP (Success) | OTP (Fail) |
845
+ |--------------|-----|---------------|------------|
846
+ | 1259257649 | 123456 | 315632 | 315633 |
847
+
848
+ ### Test Amounts
849
+
850
+ | Payment Method | Amount (Kobo) | Result |
851
+ |----------------|---------------|--------|
852
+ | BankTransfer | 2300 | SUCCESS |
853
+ | BankTransfer | 2400 | FAIL |
854
+ | BankUssd | 1300 | SUCCESS |
855
+ | BankUssd | 1400 | FAIL |
856
+
857
+ ---
858
+
859
+ ## Mobile SDK Integration
860
+
861
+ ### Android SDK
862
+
863
+ **Gradle Dependency:**
864
+ ```gradle
865
+ implementation files('libs/cashier-sdk-1.1.2.aar')
866
+ ```
867
+
868
+ **Initialize:**
869
+ ```java
870
+ // Set environment (true = sandbox, false = production)
871
+ PaymentTask.Companion.setSandBox(true);
872
+ ```
873
+
874
+ **Create Payment:**
875
+ ```java
876
+ PayInput payInput = new PayInput(
877
+ "OPAYPUB123456", // Public Key
878
+ "256612345678901", // Merchant ID
879
+ "Merchant Name", // Display Name
880
+ "order-123", // Reference
881
+ "NG", // Country
882
+ 10000, // Amount (kobos)
883
+ "NGN", // Currency
884
+ "Product Name", // Product Name
885
+ "Description", // Product Description
886
+ "https://callback.url", // Callback URL
887
+ "BankCard", // Payment Method (optional)
888
+ 30, // Expire At (minutes)
889
+ "192.168.1.1", // User IP
890
+ new UserInfo("userId", "userName", "userPhone", "userEmail")
891
+ );
892
+
893
+ new PaymentTask(this).createOrder(payInput, (status, response) -> {
894
+ switch (status) {
895
+ case SUCCESS:
896
+ // Handle success
897
+ break;
898
+ case ERROR:
899
+ // Handle error
900
+ break;
901
+ }
902
+ return Unit.INSTANCE;
903
+ });
904
+ ```
905
+
906
+ **Handle Payment Result:**
907
+ ```java
908
+ @Override
909
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
910
+ super.onActivityResult(requestCode, resultCode, data);
911
+ if (requestCode == PaymentTask.REQUEST_PAYMENT) {
912
+ if (resultCode == PaymentTask.RESULT_PAYMENT) {
913
+ WebJsResponse response = (WebJsResponse) data.getExtras()
914
+ .getSerializable(PaymentTask.RESPONSE_DATA);
915
+ switch (response.getOrderStatus()) {
916
+ case PaymentStatus.SUCCESS:
917
+ // Payment successful
918
+ break;
919
+ case PaymentStatus.FAIL:
920
+ // Payment failed
921
+ break;
922
+ case PaymentStatus.PENDING:
923
+ // Payment pending
924
+ break;
925
+ }
926
+ }
927
+ }
928
+ }
929
+ ```
930
+
931
+ **Query Order Status:**
932
+ ```java
933
+ CashierStatusInput statusInput = new CashierStatusInput(
934
+ "{PublicKey}",
935
+ "256612345678901",
936
+ "order-123",
937
+ "",
938
+ "NG"
939
+ );
940
+
941
+ new PaymentTask(this).getCashierStatus(statusInput, (status, response) -> {
942
+ if (status == Status.SUCCESS) {
943
+ OrderInfo orderInfo = (OrderInfo) response.getData();
944
+ // Use order info
945
+ }
946
+ return null;
947
+ });
948
+ ```
949
+
950
+ ---
951
+
952
+ ## Offline Payments API (POS)
953
+
954
+ ### API Basics
955
+
956
+ **Base URL:** `https://payapi.opayweb.com`
957
+
958
+ **Request Headers:**
959
+ ```
960
+ clientAuthKey: {YourClientAuthKey}
961
+ version: V1.0.1
962
+ bodyFormat: JSON
963
+ timestamp: {CurrentTimestampMs}
964
+ ```
965
+
966
+ **Request Body (Encrypted):**
967
+ ```json
968
+ {
969
+ "paramContent": "{RSA-Encrypted-JSON}",
970
+ "sign": "{RSA-Signature}"
971
+ }
972
+ ```
973
+
974
+ ### Authentication Flow
975
+
976
+ 1. Encrypt request parameters using OPay's public key
977
+ 2. Append timestamp to encrypted content
978
+ 3. Sign the result with your private key
979
+
980
+ ### Query Balance
981
+
982
+ **Endpoint:** `POST /api/v1/balance/query`
983
+
984
+ **Decrypted Request:**
985
+ ```json
986
+ {
987
+ "opayMerchantId": "256612345678901"
988
+ }
989
+ ```
990
+
991
+ **Decrypted Response:**
992
+ ```json
993
+ {
994
+ "usableAmount": 1000000,
995
+ "currency": "NGN",
996
+ "opayAccountNo": "1234567890",
997
+ "queryTime": 1699000000000
998
+ }
999
+ ```
1000
+
1001
+ ### Transaction Status Values
1002
+
1003
+ | Status | Description |
1004
+ |--------|-------------|
1005
+ | SUCCESS | Payment successful, money credited |
1006
+ | FAIL | Payment failed |
1007
+ | CLOSE | Payment closed due to timeout |
1008
+ | CANCEL | Payment cancelled by operator |
1009
+ | PENDING | Awaiting customer payment |
1010
+
1011
+ ---
1012
+
1013
+ ## Best Practices
1014
+
1015
+ 1. **Always verify webhooks** - Check signature and call Query Status API
1016
+ 2. **Handle all status values** - Implement logic for SUCCESS, FAIL, PENDING, CLOSE
1017
+ 3. **Use idempotent references** - Each payment should have a unique reference
1018
+ 4. **Store order numbers** - Save both your reference and OPay's orderNo
1019
+ 5. **Implement retry logic** - Handle temporary failures gracefully
1020
+ 6. **Test thoroughly** - Use sandbox environment with test cards
1021
+ 7. **Secure your keys** - Never expose Secret Key in client-side code
1022
+ 8. **Set appropriate timeouts** - Use expireAt parameter based on use case