Hallo,
ich versuche einen Bezahlprozess für Paypal Plus einzubauen. Das funktioniert soweit auch mittels PHP Curl.
Was ich nur garnicht verstehe wie ich die Payment Ressource per PATCH update.
Update Your Payment Resource
Was ich nicht verstehe wie ich das ausführen soll, wenn der Nutzer die Paymentmethode ausgewählt hat.
ich versuche einen Bezahlprozess für Paypal Plus einzubauen. Das funktioniert soweit auch mittels PHP Curl.
Was ich nur garnicht verstehe wie ich die Payment Ressource per PATCH update.
Update Your Payment Resource
Was ich nicht verstehe wie ich das ausführen soll, wenn der Nutzer die Paymentmethode ausgewählt hat.
PHP:
$ch = curl_init($paypalUrl.'/v1/payments/payment');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer '.$json->access_token
));
$data =
'[{
"op": "replace",
"path": "/transactions/0/amount",
"value":{
"total": "0.01",
"currency": "EUR",
"details": {
"subtotal": "4.99",
"shipping": "1.00",
"shipping_discount": "-5.98",
}
}
}],
[{
"op": "add",
"path": "/transactions/0/item_list/shipping_address
"value": {
"recipient_name": "Max Mustermann",
"line1": "Lieferstr. 1",
"city": "Berlin",
"country_code": "DE",
"postal_code": "12345"
}
}],
[{
"op": "add",
"path": "/payer/payer_info",
"value": {
"first_name": "Max",
"last_name": "Mustermann",
"email": "max@mustermann.com",
"billing_address": [{
"line1": "Lieferstr. 1",
"city": "Berlin",
"country_code": "DE",
"postal_code": "12345"
}]
}
}]';
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
$jsonResult = json_decode($result);
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);