Paypal webhook – ako ziskat prijate data

MKI-Miro
Člen | 201
+
0
-

Ahojte

Ma niektor integrovane v nette paypal webhooky?

Skusam to prave spravit a nejako sa mi nedari.

PayPal by mal poslat na zadanu url nieco taketo:

{
  "id": "WHPOC2017-9WY437509V4499423",
  "create_time": "2017-02-14T18:28:16Z",
  "resource_type": "order",
  "event_type": "PAYMENT.ORDER.CANCELLED",
  "summary": "A Payment order is cancelled",
  "resource": {
    "parent_payment": "PAY-8U555528BH195130VLCRUVPA",
    "update_time": "2017-02-14T18:28:37Z",
    "amount": {
      "total": "4.54",
      "currency": "USD"
    },
    "is_final_capture": true,
    "create_time": "2017-02-14T18:28:16Z",
    "transaction_fee": {
      "value": "0.43",
      "currency": "USD"
    },
    "links": [
      {
        "href": "https://www.api.paypal.com/v1/payments/capture/9WY437509V4499423",
        "rel": "self",
        "method": "GET"
      },
      {
        "href": "https://www.api.paypal.com/v1/payments/capture/9WY437509V4499423/refund",
        "rel": "refund",
        "method": "POST"
      },
      {
        "href": "https://www.api.paypal.com/v1/payments/orders/O-7K226695UU6131610",
        "rel": "order",
        "method": "GET"
      },
      {
        "href": "https://www.api.paypal.com/v1/payments/payment/PAY-8U555528BH195130VLCRUVPA",
        "rel": "parent_payment",
        "method": "GET"
      }
    ],
    "id": "O-7K226695UU6131610",
    "state": "completed",
    "reasonCode": "None"
  },
  "links": [
    {
      "href": "https://api.paypal.com/v1/notifications/webhooks-events/WHPOC2017-9WY437509V4499423",
      "rel": "self",
      "method": "GET",
      "encType": "application/json"
    },
    {
      "href": "https://api.paypal.com/v1/notifications/webhooks-events/WHPOC2017-9WY437509V4499423/resend",
      "rel": "resend",
      "method": "POST",
      "encType": "application/json"
    }
  ],
  "event_version": "1.0"
}

ja ked si dam vypisat reuqest

public function actionWebhook(): void
    {
        $httpRequest = $this->getHttpRequest();

        Debugger::log($postData);

tak dostanem len nieco taketo

[2021-01-15 16-02-19] Nette\Http\Request #12 method: 'POST' url: Nette\Http\UrlScript #13 |  scriptPath: '/' |  basePath: '/' |  scheme: 'https' |  user: '' |  password: '' |  host: 'www.puzzlemania.sk' |  port: 443 |  path: '/paypal/webhook' |  query: array (0) |  fragment: '' |  authority: 'www.puzzlemania.sk' post: array (0) files: array (0) cookies: array (0) headers: array (21) |  'host' => 'www.puzzlemania.sk' |  'x-real-ip' => '66.211.170.66' |  'x-forwarded-for' => '66.211.170.66, 66.211.170.66' |  'x-forwarded-proto' => 'https' |  'https' => '1' |  'x-proxy-ip' => '10.10.2.105' |  'accept' => '*/*' |  'paypal-transmission-id' => '97905a10-5742-11eb-bd69-d33f96f171bf' |  'paypal-transmission-time' => '2021-01-15T15:01:48Z' |  'paypal-transmission-sig' => 'bBfLrhrMRWfR6dNwSGLIZDLMe/eRXk2S/71XAsnNvvGlj1H9pDMVVw0H589fCFzYxpDnjy6pCuET5j35o808j66thpCW+fPa/jSuaoK5NesM4Wjlbj3bneea9qjAVqdU8g6X2WIlY7nNsIzhHIz9ca ... VrryEFlw==' |  'paypal-auth-version' => 'v2' |  'paypal-cert-url' => 'https://api.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-5edc0ebc' |  'paypal-auth-algo' => 'SHA256withRSA' |  'content-type' => 'application/json' |  'user-agent' => 'PayPal/AUHD-214.0-55012593' |  'correlation-id' => 'b3dadecb7d028' |  'max-forwards' => '7' |  'x-forwarded-host' => 'www.puzzlemania.sk' |  'x-forwarded-server' => 'www.puzzlemania.sk' |  'content-length' => '1245' |  'connection' => 'close' remoteAddress: '66.211.170.66' remoteHost: null rawBodyCallback: Closure() #14  @

ako sa dostanem k tym datam ?

dakujem

David Matějka
Moderator | 6353
+
+1
-
Nette\Utils\Json::decode($httpRequest->getRawBody());
MKI-Miro
Člen | 201
+
0
-

super dakujem !