First of all, you need to setup your recurring web hook URL(key, value) in paybull merchant panel at https://app.paybull.com/merchant/apisetting For recurring payment, merchant must set recurring_web_hook_key with invoice. Paybull validates this key exists in database while purchase request.
For each recurring payment, Paybull send a POST request to merchant recurring web hook url with following parameters given below.
Type | Params | Sample Value |
---|---|---|
Key | merchant_key | $2y$10$snLdZ5xKfpmP561tpNlfWurcNl8r.r7Jg.w8Fi88PGFiGPQDOlfXO |
Key | invoice_id | 266011626686877 |
Key | order_id | 162709021159202 |
Key | product_price | 0.10 |
Key | plan_code | 162668699215UOjS |
Key | recurring_number | 6 |
Key | status | Completed |
Key | attempts | 1 |
Key | action_date | 2021-07-24 03:00:49 |
Adım 1: Validate request is POST and merchant key is valid.
Adım 2: After that, call recurring query API.
Method | URL | Content-Type |
---|---|---|
POST | application/json |
Type | Params | Data Type | Condition |
---|---|---|---|
HEADER | Authorization | string | Mandatory |
HEADER | Accept | string | Mandatory |
KEY | merchant_key | string | Mandatory |
KEY | plan_code | string | Mandatory |
KEY | recurring_number | Integer | Mandatory |
Authorization, is a header key which defines verification that the connection attempt is allowed. The method should be “Bearer”.
Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImRlMG
VlZGFiZjdhZDhkODYzYTgyMzQ4Nzk5NTFkYzFlMDZkZTUxYjU0NW
RjYmU3MzRjMmQ1OGNkMWFlOWE4YjliZTkyMjdlZGVmZDdlMDliIn0
.eyJhdWQiOiIxNSIsImp0aSI6ImRlMGVlZGFiZjdhZDhkODYzYTgyMzQ
4Nzk5NTFkYzFlMDZkZTUxYjU0NWRjYmU3MzRjMmQ1OGNkMWFlOW
E4YjliZTkyMjdlZGVmZDdlMDliIiwiaWF0IjoxNTczNzUyNDcyLCJuYmYiOjE
1NzM3NTI0NzIsImV4cCI6MTYwNTM3NDg3Miwic3ViIjoiMSIsInNjb3BlcyI6W119.
Acceept
Accept, determines what type of representation is desired at client side. The value should be “application/json”.
merchant_key
merchant key, is unique key of the merchant provided by Paybull.
plan_code
plan_code, is unique key that was generated while first payment.( In this case, plan_code should be taken from web hook response).
recurring_number
recurring_number must be taken from webHook request sent be Paybull at every recurrence.