整个贝宝流程是一场又一场噩梦。除了一个小问题,我已经设法完成了所有的申请。来自贝宝CCD_ 1的响应对象没有文档。我的前端是客户端,所以我真的无法知道这个响应数组包含什么。
到目前为止,我得到的是:
$paymentId = $this->ppconf; //stores paymentId
if(empty($paymentId)){Throw New 'Exception('missing payment id'); }
$payment = Payment::get($paymentId, $apiContext);
$execution = new PaymentExecution();
$execution->setPayerId($z);
$response = $payment->execute($execution, $apiContext); // i need to know what this response array looks like and what the response codes are, so i can generate my $result array for my application.
$state = $response->getState();
$failures = ['failed','canceled','expired'];
if(in_array($state,$failures)){
$result = ['type'=>'error'];
}else{
$result = ['type'=>'success'];
$this->finished = true;
}
return $result;
根据文档:https://developer.paypal.com/webapps/developer/docs/api/#execute-经批准的贝宝支付
返回已完成PayPal支付的支付对象。
所以大概是PayPal''Api''Payment对象的一个实例。
您应该能够使用以下方式获取付款的国家财产:
$response->getState();
返回以下字符串之一:
创建、批准、失败、取消、过期