Recurring WebHook

First of all, you need to setup your recurring web hook URL(key, value) in sipay merchant panel at https://app.sipay.com.tr/merchant/apisetting For recurring payment, merchant must set recurring_web_hook_key with invoice. Sipay validates this key exists in database while purchase request.

For each recurring payment, Sipay 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

Suggested guideline to implement web hook

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 /api/recurringPlan/query 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

Authorization, is a header key which defines verification that the connection attempt is allowed. The method should be “Bearer”.

Example Value

 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 Sipay.

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 Sipay at every recurrence.

Response Example