【问题标题】:PayPal REST completePurchase fee informationPayPal REST 完成购买费用信息
【发布时间】:2020-01-22 13:38:54
【问题描述】:

如何从 PayPal 收取费用?

当我完成购买后,我可以执行 $data = $response->getData(),我会得到以下信息:

Array (
    [id] => PAYID-LYUDPFA8E292123AP955374L
    [intent] => sale
    [state] => approved
    [cart] => 3CN05415NR550735F
    [payer] => Array (
    [payment_method] => paypal
    [status] => VERIFIED
    [payer_info] => Array (
    [email] => accounting-buyer@mobipium.com
    [first_name] => test
    [last_name] => buyer
    [payer_id] => GTHZDZWYCELWU
    [shipping_address] => Array (
    [recipient_name] => test buyer
    [line1] => 1 Main St
    [city] => San Jose
    [state] => CA
    [postal_code] => 95131
    [country_code] => US
    )
    [country_code] => US
    )
    )
    [transactions] => Array (
    [0] => Array (
    [amount] => Array (
    [total] => 1500.00
    [currency] => EUR
    [details] => Array (
    [subtotal] => 1500.00
    [shipping] => 0.00
    [insurance] => 0.00
    [handling_fee] => 0.00
    [shipping_discount] => 0.00
    )
    )
    [payee] => Array (
    [merchant_id] => PCQDHVBJUD4WN
    [email] => accounting-facilitator@mobipium.com
    )
    [description] => 5e2837933fdc3
    [invoice_number] => 5e2837933fdc3
    [item_list] => Array (
    [shipping_address] => Array (
    [recipient_name] => test buyer
    [line1] => 1 Main St
    [city] => San Jose
    [state] => CA
    [postal_code] => 95131
    [country_code] => US
    )
    )
    [related_resources] => Array (
    [0] => Array (
    [sale] => Array (
    [id] => 9XL29023PP3022045
    [state] => pending
    [amount] => Array (
    [total] => 1500.00
    [currency] => EUR
    [details] => Array (
    [subtotal] => 1500.00
    [shipping] => 0.00
    [insurance] => 0.00
    [handling_fee] => 0.00
    [shipping_discount] => 0.00
    )
    )
    [payment_mode] => INSTANT_TRANSFER
    [reason_code] => RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION
    [protection_eligibility] => ELIGIBLE
    [protection_eligibility_type] => ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE
    [receivable_amount] => Array (
    [value] => 1500.00
    [currency] => EUR
    )
    [exchange_rate] => 0.8627555079
    [parent_payment] => PAYID-LYUDPFA8E292123AP955374L
    [create_time] => 2020-01-22T11:53:12Z
    [update_time] => 2020-01-22T11:53:12Z
    [links] => Array (
    [0] => Array (
    [href] => https://api.sandbox.paypal.com/v1/payments/sale/9XL29023PP3022045
    [rel] => self
    [method] => GET
    )
    [1] => Array (
    [href] => https://api.sandbox.paypal.com/v1/payments/sale/9XL29023PP3022045/refund
    [rel] => refund
    [method] => POST
    )
    [2] => Array (
    [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LYUDPFA8E292123AP955374L
    [rel] => parent_payment
    [method] => GET
    )
    )
    )
    )
    )
    )
    )
    [create_time] => 2020-01-22T11:52:52Z
    [update_time] => 2020-01-22T11:53:12Z
    [links] => Array (
    [0] => Array (
    [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LYUDPFA8E292123AP955374L
    [rel] => self
    [method] => GET
    )
    )
)

我只能看到 handling_fee 字段,但是当我访问我的辅导员帐户时 https://gyazo.com/fc55e97066ee755efee7867a3c42e913 我可以看到估计的字段,我怎样才能得到这个字段? 我已经与贝宝进行了集成,我可以从 $response['data']['transactions'][0]['related_resources'][0]['sale']['transaction_fee']['value']; 但是这个现场销售没有transaction_fee 字段。

【问题讨论】:

    标签: paypal


    【解决方案1】:

    必须执行state=>approved 中的付款才能进入state=> completed

    一旦付款完成或至少待处理,其销售对象(在您的示例中位于https://api.sandbox.paypal.com/v1/payments/sale/9XL29023PP3022045)应该包含财务详细信息。这是具有实际会计价值的标识符,将在 paypal.com 帐户中保留多年。

    在您的示例中,支付对象 id PAYID-LYUDPFA8E292123AP955374L 仅在支付批准和执行过程中使用。出于调试目的,它只需要保留大约 1 个月,因为它没有会计价值,并且不会在 paypal.com 中引用

    【讨论】:

      猜你喜欢
      • 2012-11-11
      • 2010-11-01
      • 1970-01-01
      • 2021-09-12
      • 2019-04-29
      • 2013-10-29
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多