Last active
February 17, 2023 00:45
-
-
Save puuble/fe42a0f21d4605b601224118317e15fe to your computer and use it in GitHub Desktop.
Posentegra Help - Order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Siparisler uzerinden islem yapmak icin PUT methoduyla ilgili URL tetiklenirken asagidaki sekilde gerekli fieldlari gonderebilirsiniz | |
* asagidaki ornekte trendyol uzerinde yapilacak islemlerin ornekleri bulunmaktadir. | |
*/ | |
<?php | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => '/ty/order/{eventType}', // {eventType} yerine gelebilecek alanlar verify,pickup,prepare,cancel,complete | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => '', | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 0, | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => 'PUT', | |
CURLOPT_POSTFIELDS =>'{ | |
"orderId": "pivot_id", // 212 | |
"callbackURL": "islem sonucunu bildirmek icin gerekli URL" // https://example.com/order/cancel/212 | |
}', | |
CURLOPT_HTTPHEADER => array( | |
'Content-Type: application/json' | |
), | |
)); | |
$response = curl_exec($curl); | |
curl_close($curl); | |
echo $response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new Client(); | |
$headers = [ | |
'Content-Type' => 'application/json' | |
]; | |
$body = '{ | |
"orderId": "pivot_id", | |
"callbackURL": "islem sonucunu bildirmek icin gerekli URL" | |
}'; | |
$request = new Request('PUT', '/ty/order/{eventType}', $headers, $body); | |
$res = $client->sendAsync($request)->wait(); | |
echo $res->getBody(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CallbackURL zorunlu değildir.
Yapılan işlemler eğer network ile ilgili bir sıkıntı yoksa her zaman sonuç olumlu döner.
Bu nedenle islemin sonucunu size iletmemiz icin bir callbackURL belirleyebilir o URL ye otomatik olarak
islem sonucu webhook.php de anlatigim formatta doner.
Ornegin onaylama islemi yaptiginizda
Boylelikle URL ye gelen bilgi ile siparisi cekebilir ve siparisten hangi restoran oldugunu bulabilir ve o restorani siparis hakkindaki bilgileri gosterebilirsiniz.
Eger callbackURL kullanmazsaniz Siparis listelerini veren endpointimiz uzerinden siparis durumunu takip edebilirsiniz.
URL YAPILARI
url yapıları provider alanında verilen slug ile belirlenir.
### providerlarimiz
Yemek Sepeti : ys
Getir : getir
Migros : migros
Trendyol : ty
Ornekler:
ys/order/verify - Yemek sepeti onaylama
migros/order/cancel - Migros iptal
getir/order/pickup - yola cikarma
Event type: