Salve a te!
Fortunatamente Paypal ha una tonnellata di documentazione, dovresti riuscire a trovare tutto qui https://developer.paypal.com/docs/checkout/#home
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 :
Ma ho una doppia risposta nel webhook :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>
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à.
Rieccomi , continuo a pensare che nonostante la documentazione essendo un colosso , lavorino un pò con i piedi ...
Sono riuscito a creare il pulsante il pagamento parte , quando analizzo le notifiche inviate al webhook ho :
Nella prima notifica ho tutti i dati che mi servono ma non ho la certezza che il pagamento sia stato completato .codice:[21/03/2022 12:39 PM] - ########################## NEW PAYOUT LISTENER WEBHOOK############################## [21/03/2022 12:39 PM] - {"id":"WH-20J32225S3417372Y-5AP84659MH055094X","event_version":"1.0","create_time":"2022-03-21T11:39:12.893Z","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-21T11:39:04Z","create_time":"2022-03-21T11:38:48Z","purchase_units":[{"reference_id":"default","amount":{"currency_code":"EUR","value":"2.16","breakdown":{"item_total":{"currency_code":"EUR","value":"2.16"}}},"payee":{"email_address":"xxx@info.it","merchant_id":"RCHWZPDVRSCT8"},"custom_id":"35","items":[{"name":"35 ","unit_amount":{"currency_code":"EUR","value":"2.16"},"quantity":"1","description":"Acquisto tratta 35"}],"shipping":{"name":{"full_name":"Stefano xxx"},"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":"84V56815CD994871G","status":"COMPLETED","amount":{"currency_code":"EUR","value":"2.16"},"final_capture":true,"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"seller_receivable_breakdown":{"gross_amount":{"currency_code":"EUR","value":"2.16"},"paypal_fee":{"currency_code":"EUR","value":"0.42"},"net_amount":{"currency_code":"EUR","value":"1.74"}},"links":[{"href":"https://api.sandbox.paypal.com/v2/payments/captures/84V56815CD994871G","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/payments/captures/84V56815CD994871G/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/7DA98695HD745122N","rel":"up","method":"GET"}],"create_time":"2022-03-21T11:39:04Z","update_time":"2022-03-21T11:39:04Z"}]}}],"links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/7DA98695HD745122N","rel":"self","method":"GET"}],"id":"7DA98695HD745122N","intent":"CAPTURE","payer":{"name":{"given_name":"Stefano","surname":"hhhhh"},"email_address":"utente@prova.it","payer_id":"E9ZP8U9DLDL8U","address":{"country_code":"IT"}},"status":"COMPLETED"},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-20J32225S3417372Y-5AP84659MH055094X","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-20J32225S3417372Y-5AP84659MH055094X/resend","rel":"resend","method":"POST"}]} [21/03/2022 12:39 PM] - ########################## NEW PAYOUT LISTENER WEBHOOK############################## [21/03/2022 12:39 PM] - {"id":"WH-2RV50120BS805074E-9V611821V1567411W","event_version":"1.0","create_time":"2022-03-21T11:39:09.449Z","resource_type":"capture","resource_version":"2.0","event_type":"PAYMENT.CAPTURE.COMPLETED","summary":"Payment completed for EUR 2.16 EUR","resource":{"amount":{"value":"2.16","currency_code":"EUR"},"seller_protection":{"dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"],"status":"ELIGIBLE"},"supplementary_data":{"related_ids":{"order_id":"7DA98695HD745122N"}},"update_time":"2022-03-21T11:39:04Z","create_time":"2022-03-21T11:39:04Z","final_capture":true,"seller_receivable_breakdown":{"paypal_fee":{"value":"0.42","currency_code":"EUR"},"gross_amount":{"value":"2.16","currency_code":"EUR"},"net_amount":{"value":"1.74","currency_code":"EUR"}},"custom_id":"35","links":[{"method":"GET","rel":"self","href":"https://api.sandbox.paypal.com/v2/payments/captures/84V56815CD994871G"},{"method":"POST","rel":"refund","href":"https://api.sandbox.paypal.com/v2/payments/captures/84V56815CD994871G/refund"},{"method":"GET","rel":"up","href":"https://api.sandbox.paypal.com/v2/checkout/orders/7DA98695HD745122N"}],"id":"84V56815CD994871G","status":"COMPLETED"},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-2RV50120BS805074E-9V611821V1567411W","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-2RV50120BS805074E-9V611821V1567411W/resend","rel":"resend","method":"POST"}]}
Nella seconda notifica ho che il pagamento è stato completato ma non ho molte informazioni come ad esempio chi ha effettuato il pagamento ... Ma è una cosa normale ?