Quote Originariamente inviata da andreacanton Visualizza il messaggio
Salve a te!

Fortunatamente Paypal ha una tonnellata di documentazione, dovresti riuscire a trovare tutto qui https://developer.paypal.com/docs/checkout/#home

Grazie , ho utilizzato questo pulsante :


codice:
<script>


  paypal.Buttons({
    createOrder: function(data, actions) {
      return actions.order.create({
         "purchase_units": [{
            "amount": {
              "currency_code": "EUR",
              "value": "100",
              "breakdown": {
                "item_total": {  /* Required when including the `items` array */
                  "currency_code": "EUR",
                  "value": "100"
                }
              }
            },
            "items": [
              {
                "name": "PROVA CREAZIONE ", /* Shows within upper-right dropdown during payment approval */
                "description": "A|b|C", /* Item details will also be in the completed paypal.com transaction view */
                "unit_amount": {
                  "currency_code": "EUR",
                  "value": "100"
                },
                "quantity": "1"
              },
            ]
          }]
      });
    },
  }).render('#paypal-button-container');




</script>
Ma ho una doppia risposta nel webhook :

codice:
[14/03/2022 7:38 PM] - ########################## NEW PAYOUT LISTENER############################## 


[14/03/2022 7:38 PM] - {"id":"WH-8Y260634BH969130U-4D860759C5630044F","event_version":"1.0","create_time":"2022-03-15T00:38:42.450Z","resource_type":"checkout-order","resource_version":"2.0","event_type":"CHECKOUT.ORDER.APPROVED","summary":"An order has been approved by buyer","resource":{"update_time":"2022-03-15T00:38:37Z","create_time":"2022-03-15T00:38:07Z","purchase_units":[{"reference_id":"default","amount":{"currency_code":"EUR","value":"100.00","breakdown":{"item_total":{"currency_code":"EUR","value":"100.00"}}},"payee":{"email_address":"topwebsite_ncc@info.it","merchant_id":"RCHWZPDVRSCT8"},"items":[{"name":"PROVA CREAZIONE ","unit_amount":{"currency_code":"EUR","value":"100.00"},"quantity":"1","description":"A|b|C"}],"shipping":{"name":{"full_name":"Stefano Banchelli"},"address":{"address_line_1":"Via Unit? d'Italia","admin_area_2":"Napoli","admin_area_1":"Napoli","postal_code":"80127","country_code":"IT"}},"payments":{"captures":[{"id":"3XK82210D17883106","status":"COMPLETED","amount":{"currency_code":"EUR","value":"100.00"},"final_capture":true,"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"seller_receivable_breakdown":{"gross_amount":{"currency_code":"EUR","value":"100.00"},"paypal_fee":{"currency_code":"EUR","value":"3.75"},"net_amount":{"currency_code":"EUR","value":"96.25"}},"links":[{"href":"https://api.sandbox.paypal.com/v2/payments/captures/3XK82210D17883106","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/payments/captures/3XK82210D17883106/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6MM148212F160372M","rel":"up","method":"GET"}],"create_time":"2022-03-15T00:38:37Z","update_time":"2022-03-15T00:38:37Z"}]}}],"links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/6MM148212F160372M","rel":"self","method":"GET"}],"id":"6MM148212F160372M","intent":"CAPTURE","payer":{"name":{"given_name":"Stefano","surname":"Banchelli"},"email_address":"utente_ncc@topwebsite.it","payer_id":"E9ZP8U9DLDL8U","address":{"country_code":"IT"}},"status":"COMPLETED"},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8Y260634BH969130U-4D860759C5630044F","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8Y260634BH969130U-4D860759C5630044F/resend","rel":"resend","method":"POST"}]}


[14/03/2022 7:38 PM] - JSON DECODE


[14/03/2022 7:38 PM] - ########################## NEW PAYOUT LISTENER############################## 


[14/03/2022 7:38 PM] - {"id":"WH-24H621511B133103T-77Y53377L7252372X","event_version":"1.0","create_time":"2022-03-15T00:38:40.713Z","resource_type":"capture","resource_version":"2.0","event_type":"PAYMENT.CAPTURE.COMPLETED","summary":"Payment completed for EUR 100.0 EUR","resource":{"amount":{"value":"100.00","currency_code":"EUR"},"seller_protection":{"dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"],"status":"ELIGIBLE"},"supplementary_data":{"related_ids":{"order_id":"6MM148212F160372M"}},"update_time":"2022-03-15T00:38:37Z","create_time":"2022-03-15T00:38:37Z","final_capture":true,"seller_receivable_breakdown":{"paypal_fee":{"value":"3.75","currency_code":"EUR"},"gross_amount":{"value":"100.00","currency_code":"EUR"},"net_amount":{"value":"96.25","currency_code":"EUR"}},"links":[{"method":"GET","rel":"self","href":"https://api.sandbox.paypal.com/v2/payments/captures/3XK82210D17883106"},{"method":"POST","rel":"refund","href":"https://api.sandbox.paypal.com/v2/payments/captures/3XK82210D17883106/refund"},{"method":"GET","rel":"up","href":"https://api.sandbox.paypal.com/v2/checkout/orders/6MM148212F160372M"}],"id":"3XK82210D17883106","status":"COMPLETED"},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-24H621511B133103T-77Y53377L7252372X","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-24H621511B133103T-77Y53377L7252372X/resend","rel":"resend","method":"POST"}]}


[14/03/2022 7:38 PM] - JSON DECODE

, invece vorrei avere la stessa che nel simulator e mi interesserebbe un campo custom in cui inserire una stringa ( che qui appare nel primo response [description":"A|b|C"] ma vorrei apparisse nel pagamento effettuato per poi salvarmi i dati nel database perchè è inutile che ho dei dati se poi non li ritrovo alla canferma del pagamento che è querllo che a me serve in realtà.