好的,我设法创建了一个Webhook,现在正在尝试接收PAYMENT.SALE.COMPLETED
和PAYMENT.SALE.REFUNDED
事件。到目前为止,我得到了:
$webhookEvent = new \PayPal\Api\WebhookEvent();
$webhookEvent->fromJson($requestBody);
$payment = $webhookEvent->getResource();
但是我现在如何获得付款细节,例如金额,交易ID或payerinfo? $payment->getAmount()
似乎无效。看来付款只是一个对象数组(PayPal \ Common \ PayPalModel),那么如何从中获取API / Payment之类的对象?