I'm trying to migrate from API V1 to V2 in PHP. In V1, you could use this code to get further payment-instructions after executing a payment:
try {
$execution = new Paypal\Api\PaymentExecution();
$execution->setPayerId($sPayerId);
$payment = \Paypal\Api\Payment::get($sPaymentId, getApiContext());
$payment->execute($execution, getApiContext());
$payment = \Paypal\Api\Payment::get($sPaymentId, getApiContext()); // re-fetch payment with payment-instructions
if ($payment->getPaymentInstruction())
{ $sBankName = $payment->getPaymentInstruction()->recipient_banking_instruction->bank_name;
$sBandAccountNumber = $payment->getPaymentInstruction()->recipient_banking_instruction->international_bank_account_number;
...
}
}
catch(PayPal\Exception\PayPalConnectionException $ex) {
...
}
It's important for us to display the payment-instructions to our customer: If they use the "pay later"/"pay via invoice"-feature, they need to know to which bank and account to transfer the money to.
In API V2, you use this code to capture an authorized order:
$request = new PayPalCheckoutSdk\Orders\OrdersCaptureRequest($sOrderId);
try {
$response = getClient()->execute($request);
}
catch(PayPalHttp\HttpException $exception) {
....
}
So what are the next steps to get the payment-instructions now?
The field was not documented for the v1/payments API.
For v2/checkout/orders , a
payment_instructionfield is documented as an order creation request field (within purchase_units) and response field.A similar field exists when capturing an authorization.
For Pay Upon Invoice, there is a
processing_instructionfield.In all these cases, the fields do not contain information regarding "which bank and account to transfer the money to" or similar.
However, for PUI there is a response field
payment_source.pay_upon_invoice.deposit_bank_details. Perhaps this is what you are looking for.