PayPal:从付款

时间:2015-09-25 12:54:48

标签: .net api paypal

我正在使用forpal的paypal API,我正在通过以下方式创建付款:POST / v1 / payments / payment。

我的付款创建请求:

Payment = {
  intent: 'sale',
  payer = {
    payment_method = 'paypal'
  },
  transactions = [
    transaction= = {
      amount = {
        currency = 'GBP',
        total = '10.00'
      },
      item_list = {
        items = [
          item = {
            quantity = '1',
            name = 'name',
            price = '10.00',
            currency = 'GBP',
            sku = 'description'
          }
        ],
        shipping_address = {
          recipient_name = 'name',
          line1 = 'address',
          city = 'city',
          country_code = 'GB',
          postal_code = 'G69 7LS'
        }
      }
    }
  ],
  redirect_urls = {
    return_url = 'http://localhost/',
    cancel_url = 'http://localhost/'
  }
}

正如您所看到的,我没有创建类型" sale"的相关交易。

创建并执行付款后,在某些情况下我们需要退还客户的款项,但要退款,我们需要salesId。我试图通过付款创建生成saleId,但它仍然失败,因为API似乎忽略了销售对象。

1 个答案:

答案 0 :(得分:1)

拨打此电话后,PayPal会返回一个链接,将客户引导至PayPal。之后,它返回到您指定的返回URL。然后,您执行执行付款电话:

https://api.sandbox.paypal.com/v1/payments/payment/<Payment-Id>/execute/

该回复将是您要查找的信息。

Response =&gt; transactions =&gt; related_resources =&gt; sale =&gt; id是带有id的变量。

此外,Response =&gt; transactions =&gt; related_resources =&gt;链接将有一个用于退款的链接。

相关问题