You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> :heavy_exclamation_mark: If you want to accept payment callback from the payment gateway on your local computer for development purpose, consider to use [ngrok.io](https://ngrok.io) to expose your localhost to the internet and update the callback base URL in payment gateway dashboard and `SERVER_BASE_URL` accordingly.
298
+
You can find the sample code in [here](/example/server)
369
299
370
300
## API Usage
371
301
372
-
Your client webservice can interact to at least 2 endpoints:
373
-
374
-
- GET all payment methods available
375
-
- POST generating new invoice
376
-
377
-
### POSTMAN JSON
378
-
379
-
You can download this POSTMAN json file to see how to use the api. [POSTMAN COLLECTION](/example/server/go-payment.postman_collection.json)
380
-
381
-
### List of payment methods
382
-
383
-
#### Request
384
-
385
-
If you want to get the estimated admin/installment fee for each payment methods, provice this GET request with optional `price` and `currency` query. Otherwise, it returns nil `admin_fee` and `installment_fee`
386
-
387
-
```http
388
-
GET /payment/methods?price=1000¤cy=IDR
389
-
```
390
-
391
-
#### Response
392
-
393
-
```json
394
-
{
395
-
"card_payment": {
396
-
"payment_type": "credit_card",
397
-
"installments": [
398
-
{
399
-
"display_name": "",
400
-
"type": "offline",
401
-
"bank": "bca",
402
-
"terms": [
403
-
{
404
-
"term": 0,
405
-
"admin_fee": {
406
-
"value": 2029,
407
-
"curency": "IDR"
408
-
}
409
-
}
410
-
]
411
-
}
412
-
]
413
-
},
414
-
// ... redacted ...
415
-
"ewallets": [
416
-
{
417
-
"payment_type": "gopay",
418
-
"display_name": "Gopay",
419
-
"admin_fee": {
420
-
"value": 0,
421
-
"curency": "IDR"
422
-
}
423
-
}
424
-
]
425
-
}
426
-
```
427
-
428
-
### Generating New Invoice
429
-
430
-
Use this endpoint to create a payment request to chosen payment channels and gateway.
> To create invoice with `credit_card` payment with/without installment, please take a look [POSTMAN COLLECTION](/example/server/go-payment.postman_collection.json)
461
-
462
-
#### Response
463
-
464
-
When you call endpoint above, server returns all invoice data. But, to proceed to the payment page you need to pay attention to `payment` object.
- Value of `payment.gateway` will is always `midtrans`
487
-
- You can use `payment.token` to open snap window by using midtrans [snap.js](https://snap-docs.midtrans.com/#snap-js)
488
-
- If you want to use [Window Redirection](https://snap-docs.midtrans.com/#window-redirection), you can open a new browser tab by using url in `payment.redirect_url`
489
-
490
-
#### For Xendit Payment Channel
491
-
492
-
- Value of `payment.gateway` will is always `xendit`
493
-
-`payment.token` is always empty for all xendit provided payment channels
494
-
- You will always open `payment.redirect_url` in new browser tap for all payment methods provided by xendit. Including DANA, LinkAja, Kredivo, even Xendit Invoice.
302
+
You can find the details of API usage in [here](/docs)
0 commit comments