Skip to content

Commit 4412385

Browse files
Add example responses and descriptions to use cases
1 parent 43a5754 commit 4412385

29 files changed

+1140
-426
lines changed

dist/betting.yaml

Lines changed: 101 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
openapi: 3.0.1
22
info:
33
title: Create a betting platform
4-
description: The OpenAPI specification for creating a betting platform using the Paystack API
4+
description: |-
5+
The OpenAPI specification for creating a betting platform using the [Paystack API](https://paystack.com/docs/api/).
6+
### Prerequisites
7+
1. Sign up on [Paystack](https://paystack.com/signup) to get your secret API key
8+
2. Set your API key as an environment variable on [Postman](https://learning.postman.com/docs/sending-requests/variables/)
9+
10+
We strongly recommend using the [Bulk Transfer API](https://paystack.com/docs/transfers/bulk-transfers) for sending customers their winnings instead of using Single Transfers.
511
version: 1.0.0
612
servers:
713
- url: 'https://api.paystack.co'
@@ -118,7 +124,20 @@ paths:
118124
- subaccount
119125
responses:
120126
'200':
121-
$ref: '#/paths/~1bank~1resolve/get/responses/200'
127+
description: Request successful
128+
content:
129+
application/json:
130+
schema:
131+
$ref: '#/components/responses/Ok/content/application~1json/schema'
132+
examples:
133+
Initiailize Transaction:
134+
value:
135+
status: true
136+
message: Authorization URL created
137+
data:
138+
authorization_url: 'https://checkout.paystack.com/spnajmit2hgi2c1'
139+
access_code: spandaoende
140+
reference: ad123ada
122141
'401':
123142
$ref: '#/paths/~1bank~1resolve/get/responses/401'
124143
default:
@@ -196,7 +215,23 @@ paths:
196215
type: boolean
197216
responses:
198217
'200':
199-
$ref: '#/paths/~1bank~1resolve/get/responses/200'
218+
description: Request successful
219+
content:
220+
application/json:
221+
schema:
222+
$ref: '#/components/responses/Ok/content/application~1json/schema'
223+
examples:
224+
Charge Authorization:
225+
value:
226+
status: true
227+
message: Charge attempted
228+
data:
229+
amount: 500000
230+
currency: NGN
231+
reference: 123.uniq=ref-2
232+
metadata: 'cart_id:398, custom_fields:[{}]'
233+
split_code: SPL_123AbZ
234+
subaccount: ACCT_23abcdefgh
200235
'401':
201236
$ref: '#/paths/~1bank~1resolve/get/responses/401'
202237
default:
@@ -220,88 +255,34 @@ paths:
220255
example: '063'
221256
responses:
222257
'200':
223-
description: Request successful
258+
description: Resolve Account Number
224259
content:
225260
application/json:
226261
schema:
227262
$ref: '#/components/responses/Ok/content/application~1json/schema'
228263
examples:
229-
Initiailize Transaction:
230-
value:
231-
status: true
232-
message: Authorization URL created
233-
data:
234-
authorization_url: 'https://checkout.paystack.com/spnajmit2hgi2c1'
235-
access_code: spandaoende
236-
reference: ad123ada
237-
Charge Authorization:
238-
value:
239-
status: true
240-
message: Charge attempted
241-
data:
242-
amount: 500000
243-
currency: NGN
244-
reference: 123.uniq=ref-2
245-
metadata:
246-
'cart_id:398 custom_fields':
247-
- {}
248-
split_code: SPL_123AbZ
249-
subaccount: ACCT_23abcdefgh
250-
Resolve Account Number:
264+
Resolve Bank:
251265
value:
252266
status: true
253267
message: Account number resolved
254268
data:
255269
account_number: 1234567
256270
account_name: Doe Jane Loren
257271
bank_id: 9
258-
Initiate Transfer:
259-
value:
260-
status: true
261-
message: Transfer has been queued
262-
data:
263-
reference: on5hyz9poe
264-
integration: 428626
265-
domain: test
266-
amount: 3794800
267-
currency: NGN
268-
source: balance
269-
reason: Holiday Flexing
270-
recipient: 6788170
271-
status: success
272-
transfer_code: TRF_fiyxvgkh71e717b
273-
id: 23070321
274-
createdAt: 2020-05-13T14:22:49.687Z
275-
updatedAt: 2020-05-13T14:22:49.687Z
276-
Initiate Bulk Transfer:
277-
value:
278-
status: true
279-
message: 2 transfers queued.
280-
data:
281-
- recipient: RCP_1a25w1h3n0xctjg
282-
amount: 50000
283-
transfer_code: TRF_mi8oa4liagyvq2md
284-
currency: NGN
285-
status: success
286-
- recipient: RCP_sa1k1btncp993q1
287-
amount: 50000
288-
transfer_code: TRF_1c5upr4hp85l93n7
289-
currency: NGN
290-
status: success
291272
'401':
292273
description: Unauthorized operation
293274
content:
294275
application/json:
295276
examples:
296-
No_Authorization_Header:
277+
No-Authorization-Header:
297278
value:
298279
status: false
299280
message: No Authorization Header was found
300281
Bad-Authorization-Header:
301282
value:
302283
status: false
303284
message: 'Format is Authorization Bearer [secret key]'
304-
Invalid_Key:
285+
Invalid-Key:
305286
value:
306287
status: false
307288
message: Invalid key
@@ -375,16 +356,16 @@ paths:
375356
description: Stringified JSON object of custom data
376357
type: string
377358
example: |
378-
{transfer_id: 123}
359+
{referrer_id: 123}
379360
responses:
380361
'201':
381-
description: Resource created
362+
description: Transfer Recipient Created
382363
content:
383364
application/json:
384365
schema:
385366
$ref: '#/components/responses/Ok/content/application~1json/schema'
386367
examples:
387-
Create Transfer Recipient:
368+
Create Customer:
388369
value:
389370
status: true
390371
message: Transfer recipient created successfully
@@ -395,7 +376,9 @@ paths:
395376
domain: live
396377
id: 38770134
397378
integration: 463433
398-
name: Some Guy
379+
metadata:
380+
referrer_id: 123
381+
name: Ada Lovelace
399382
recipient_code: RCP_2fl8jmb2v3kbleb
400383
type: nuban
401384
updatedAt: 2022-09-16T08:31:43.321Z
@@ -468,7 +451,45 @@ paths:
468451
example: Transfer-123_unique
469452
responses:
470453
'200':
471-
$ref: '#/paths/~1bank~1resolve/get/responses/200'
454+
description: Request successful
455+
content:
456+
application/json:
457+
schema:
458+
$ref: '#/components/responses/Ok/content/application~1json/schema'
459+
examples:
460+
Initiate Transfer:
461+
value:
462+
status: true
463+
message: Transfer has been queued
464+
data:
465+
reference: on5hyz9poe
466+
integration: 428626
467+
domain: test
468+
amount: 3794800
469+
currency: NGN
470+
source: balance
471+
reason: Holiday Flexing
472+
recipient: 6788170
473+
status: success
474+
transfer_code: TRF_fiyxvgkh71e717b
475+
id: 23070321
476+
createdAt: 2020-05-13T14:22:49.687Z
477+
updatedAt: 2020-05-13T14:22:49.687Z
478+
Initiate Bulk Transfer:
479+
value:
480+
status: true
481+
message: 2 transfers queued.
482+
data:
483+
- recipient: RCP_1a25w1h3n0xctjg
484+
amount: 50000
485+
transfer_code: TRF_mi8oa4liagyvq2md
486+
currency: NGN
487+
status: success
488+
- recipient: RCP_sa1k1btncp993q1
489+
amount: 50000
490+
transfer_code: TRF_1c5upr4hp85l93n7
491+
currency: NGN
492+
status: success
472493
'401':
473494
$ref: '#/paths/~1bank~1resolve/get/responses/401'
474495
default:
@@ -493,12 +514,15 @@ components:
493514
first_name:
494515
description: Customer's first name
495516
type: string
517+
example: Some
496518
last_name:
497519
description: Customer's last name
498520
type: string
521+
example: Body
499522
phone:
500523
description: Customer's phone number
501524
type: string
525+
example: 2348123456789
502526
metadata:
503527
description: Stringified JSON object of custom data
504528
type: string
@@ -542,18 +566,27 @@ components:
542566
country:
543567
description: Two-letter country code of identification issuer
544568
type: string
569+
example: NG
545570
bvn:
546571
description: Customer's Bank Verification Number
547572
type: string
573+
example: 123456789
548574
bank_code:
549575
description: 'You can get the list of bank codes by calling the List Banks endpoint (https://api.paystack.co/bank).'
550576
type: string
577+
example: 7
551578
account_number:
552579
description: Customer's bank account number.
553580
type: string
554-
value:
555-
description: Customer's identification number. Required if type is bvn
581+
example: 111111111
582+
first_name:
583+
description: Customer's first name
584+
type: string
585+
example: Uchenna
586+
last_name:
587+
description: Customer's last name
556588
type: string
589+
example: Okoro
557590
Error:
558591
type: object
559592
properties:

0 commit comments

Comments
 (0)