简体   繁体   English

贝宝智能付款结帐-获取使用的付款类型

[英]Paypal smart payment checkout - Get Payment Type that was used

I've integrated the new paypal checkout order using smart payment buttons ( https://developer.paypal.com/docs/checkout/# ). 我已经使用智能付款按钮( https://developer.paypal.com/docs/checkout/# )集成了新的Paypal结帐订单。 It's working quite well allowing me to let the User pay with a Credit Card or SEPA without a paypal account: 运作良好,让我可以让使用者在没有Paypal帐户的情况下使用信用卡或SEPA进行付款:

paypal.Buttons({
  // ...
  createOrder(data, actions) {
},
  // ...
  onApprove(data, actions) {
  // data.orderID available here

Now in the User's order overview I want to display which type of payment was used and not only that they used paypal to pay me. 现在,在用户的订单总览中,我想显示使用了哪种付款方式,而不仅是他们使用贝宝付款给我。 However I cannot find a way to get that information using the @paypal/checkout-server-sdk nor the paypal-rest-sdk because all I have is the CheckoutOrder and the Capture objects. 但是,我找不到使用@paypal/checkout-server-sdkpaypal-rest-sdk来获取该信息的方法,因为我所拥有的只是CheckoutOrderCapture对象。

The orderID from the client can be used in my backend to get the Order details: 来自客户端的orderID可以在我的后端中用于获取订单详细信息:

paypalCheckoutSdk.orders.OrdersGetRequest(payload.orderID)

But all I get is this stuff: 但是我得到的只是这些东西:

"result": {
    "id": "6CC44267CA709615A",
    "intent": "CAPTURE",
    "purchase_units": [{
        "reference_id": "default",
        "amount": { ... },
        "payee": { ... },
        "shipping": {
            "name": { ... },
            "address": { ... }
        },
        "payments": {
            "captures": [{
                "id": "2GP872418N1179401",
                "status": "COMPLETED",
                "amount": { ... },
                "final_capture": true,
                "seller_protection": {...},
                "links": [...],
                ...
            }]
        }
    }],
    "payer": { ... },
    "status": "COMPLETED"
}

No information about the credit card that was used, not even that is was a credit card and not a paypal account. 没有有关已使用信用卡的信息,甚至不是信用卡信息,也不是贝宝账户。

If I try to use the paypal-rest-sdk the Order cannot even be found by that ID. 如果我尝试使用paypal-rest-sdk,则该ID甚至找不到该订单。 Must be some special checkout order. 必须是一些特殊的结帐顺序。

The Capture object paypalOrder.result.purchase_units[0].payments.captures[0].id does not help either. 捕获对象paypalOrder.result.purchase_units[0].payments.captures[0].id也不起作用。 It's quite bare and offers nothing that the Order did not already tell me. 它是光秃秃的,并没有提供命令尚未告诉我的任何内容。 No link to anywhere. 没有链接到任何地方。 The captureId does not allow me to search for a transaction or payment. captureId不允许我搜索交易或付款。

If I log into the sandbox seller account, the order does not show which payment type was used either. 如果我登录到沙盒卖家帐户,则订单也不会显示使用了哪种付款方式。 Is that information just lost? 信息丢失了吗? Or is there a way to retrieve it? 还是有办法找回它?

Thanks! 谢谢!

For this payment, 2GP872418N1179401 is the PayPal transaction ID in the seller account. 对于此付款, 2GP872418N1179401是卖方帐户中的PayPal交易ID。 It is the ID you should record in your business accounting database on capture completion, as it is what you can later reference in the seller (sandbox.)paypal.com account and reports for years to come. 这是您应该在捕获完成后记录在企业会计数据库中的ID,因为以后您可以在卖方(sandbox。)paypal.com帐户中引用该ID,并在以后的报告中使用该ID。

The top level 6CC44267CA709615A is more ephemeral, I believe that's the checkout's order ID you started with and so it's only used for the payment approval. 顶层6CC44267CA709615A更短暂,我相信这是您开始使用的结帐订单ID,因此仅用于付款批准。 I'm not sure when exactly it expires but you should only keep it around awhile for debug purposes, it has no business/accounting value. 我不确定它何时确切到期,但您仅应将其保留一段时间以用于调试目的,它没有业务/会计价值。

As for finding out what type of payment was used, PayPal keeps that information private to the payer in their design. 至于找出使用哪种付款方式,PayPal会将付款人的信息保密给他们。 Whether they used a particular Visa, MC, Amex, Discover, PayPal Credit, their balance, or some other local funding source.... that's the buyer's business; 无论他们使用的是特定的Visa,MC,Amex,Discover,PayPal Credit,他们的余额还是其他一些本地资金来源。 all the seller knows is they received a payment through PayPal. 卖方唯一知道的是他们通过PayPal收到了付款。 This said to be for security and privacy, so that if any seller's site is ever compromised, the buyer's billing information is not exposed. 据说这是出于安全和隐私的考虑,因此,如果任何卖方的网站遭到破坏,则不会暴露买方的帐单信息。

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

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