Skip to content

Commit

Permalink
Add Callback docs
Browse files Browse the repository at this point in the history
  • Loading branch information
teikun-86 committed Dec 17, 2023
1 parent b0e3195 commit c1c88cf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ From the code above, you can see that you can use `Tripay` facade to call the fu
More docs:
- [Payment](https://github.com/teikun-86/tripay-laravel/tree/main/docs/Payment.md)
- [PPOB](https://github.com/teikun-86/tripay-laravel/tree/main/docs/PPOB.md)
- [Handling Callback](https://github.com/teikun-86/tripay-laravel/tree/main/docs/Callback.md)
43 changes: 43 additions & 0 deletions docs/Callback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h2>Callback</h2>

There is 2 type of callbacks, PPOB Callback, and Payment Callback. But we only need 1 method to get the callback. That is `tripayCallback()` function that can be called globally, inside the method, we check the callback type, if the callback type is PPOB, then the instance returned is `PPOBCallback`, otherwise, it will return `Callback`.

Let's start with creating the instance.

```php
<?php
...
$callback = tripayCallback();
```

Both `PPOBCallback` and `Callback` has `payloads()` method that will return the Callback's payload.
For example:

```php
<?php
...
$payloads = $callback->payloads();
```

Callback example as JSON:

```json
{
"trxid": "158561****",
"api_trxid": "INV45769",
"via": "API",
"code": "S100",
"produk": "Telkomsel 100",
"harga": "97765",
"target": "08522083****",
"mtrpln": "-",
"note": "Trx S100 08522083**** SUKSES. SN: 845392759476503****",
"token": "845392759476503****",
"status": "1",
"saldo_before_trx": "100000",
"saldo_after_trx": "5894",
"created_at": "2019-11-06 12:07:48",
"updated_at": "2019-11-15 20:59:10",
"tagihan": null
}
```

0 comments on commit c1c88cf

Please sign in to comment.