简体   繁体   English

PayPal Plus - 付款 state 用于确认

[英]PayPal Plus - Payment state for confirmation

I'm currently implementing PayPal Plus inside a custom TYPO3 extension.我目前正在自定义 TYPO3 扩展中实现 PayPal Plus。 Everything works fine, but I'm wondering which payment states PayPal could possibly return.一切正常,但我想知道 PayPal 可能会返回哪些付款状态。

As of now, when a payment went though, I get the state "approved" and handle my code accordingly, as I figure the payment went just fine.截至目前,当付款完成时,我得到 state “批准”并相应地处理我的代码,因为我认为付款很好。 The PayPal docs are such a mystery and they are all over the place and I don't really know where to look at and every time I work with their API it feels like the first time. PayPal 文档是如此神秘,它们到处都是,我真的不知道在哪里看,每次我使用他们的 API 时,感觉就像是第一次。

This is the part where I'm currently not sure about:这是我目前不确定的部分:

$pay = $this->payPalService->executePayment(paymentId, $payerId, $json->access_token);

if ($pay->state == 'approved') {
    $this->orderService->update($paymentId);
    $this->redirect('paymentSuccessful', 'Order');
}

The essential part I'm talking about is $pay->state == 'approved' .我正在谈论的重要部分是$pay->state == 'approved' Can I assume that approved means I can safely handle the order and treat it as successfully paid?我可以假设批准意味着我可以安全地处理订单并将其视为成功付款吗? The official PayPal Plus docs don't mention that.官方PayPal Plus 文档没有提到这一点。

If you click "Reference" in the bottom left of the doc you mention, there is a link to the v1/payments API reference, which documents this execute API call and possible responses: https://developer.paypal.com/docs/api/payments/v1/#payment-execute-response If you click "Reference" in the bottom left of the doc you mention, there is a link to the v1/payments API reference, which documents this execute API call and possible responses: https://developer.paypal.com/docs/ api/payments/v1/#payment-execute-response

State ... Possible values: created,approved,failed. State ... 可能的值:创建、批准、失败。

That seems fairly straightforward as far as the values the field can take.就该字段可以采用的值而言,这似乎相当简单。 So this, "approved" means the execution was successful.因此,“批准”意味着执行成功。

However, to mark something as "successfully paid" per your question, you should be looking for a sale object in transactions[0]->related_resources[0]->sale .但是,要根据您的问题将某些内容标记为“已成功支付”,您应该在transactions[0]->related_resources[0]->sale中寻找销售 object 。 Its id is the PayPal transaction ID you should store for accounting purposes.它的 id 是 PayPal 交易 ID,您应该存储以用于会计目的。 And it will have its own "state", documented here :它会有自己的“状态”, 记录在这里

State ... Possible values: completed,partially_refunded,pending,refunded,denied State ... 可能的值:已完成、部分退款、待定、已退款、已拒绝

You should treat 'completed' as success, and 'pending' as something requiring manual attention in the PayPal.com account您应该在 PayPal.com 帐户中将“已完成”视为成功,将“待定”视为需要手动注意的事情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM