2013-10-22 81 views
6

我遵循PayPal REST API參考https://developer.paypal.com/webapps/developer/docs/api/來創建和執行付款。PayPal REST API不採用自定義送貨地址

要創建付款,我將以下數據發送到PayPal。數據包含「shipping_address」。付款已成功創建。

{ 
"intent": "sale", 
"payer": { 
    "payment_method": "paypal" 
}, 
"redirect_urls": { 
    "return_url": "http://www.somethingabc.com/approve", 
    "cancel_url": "http://www.somethingabc.com/cancel" 
}, 
"transactions": [{ 
    "amount": { 
     "currency": "USD", 
     "total": "10.00", 
     "details": { 
      "shipping": "0.00", 
      "subtotal": "10.00", 
      "tax": "0.00" 
     } 
    }, 
    "item_list": { 
     "items": [{ 
      "quantity": "1", 
      "name": "Apples", 
      "price": "10.00", 
      "currency": "USD" 
     }], 
     "shipping_address": { 
      "recipient_name": "John", 
      "type": "residential", 
      "line1": "441 Waterdale RD", 
      "city": "Heidelberg West", 
      "country_code": "AU", 
      "postal_code": "3081", 
      "state": "VICTORIA" 
     } 
    } 
}] 

}

然後,我重定向web瀏覽器在用戶登錄並批准支付PayPal的響應給出的approval_url(例如,https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-343434SADSDSAD34)。用戶登錄並出現PayPal查看網頁。我希望這個評論頁面應該顯示我之前在創建付款時提供的自定義送貨地址。但是,PayPal評論網頁顯示PayPal所有者的地址。

所以,我的問題是如何強制貝寶審查網頁顯示自定義送貨地址,而不是貝寶所有者的地址?如果無法完成,我如何獲取用戶在PayPal評論網頁上選擇的送貨地址(當我調用API執行付款時,所選送貨地址不包含在payer_info對象中!) 。

謝謝。

+0

我測試了你的代碼,它確實覆蓋並強制默認送貨地址。但是,我不確定這是否僅限於美國地址,因爲我必須將其更改爲美國地址,因爲測試憑據是美國的,並且不會讓我發貨給AU。 – Aaron

回答

0

測試您的代碼後,我找不到任何錯誤。在完成付款時,我得到的迴應:

{ 
    "id": "PAY-xxxxxxx", 
    "create_time": "2014-05-01T23:54:00Z", 
    "update_time": "2014-05-01T23:59:35Z", 
    "state": "approved", 
    "intent": "sale", 
    "payer": { 
    "payment_method": "paypal", 
    "payer_info": { 
     "email": "[email protected]", 
     "first_name": "John", 
     "last_name": "Smith", 
     "payer_id": "GPV2878GCMNGE", 
     "shipping_address": { 
     "line1": "441 Waterdale RD", 
     "city": "Heidelberg West", 
     "state": "Victoria", 
     "postal_code": "3081", 
     "country_code": "AU" 
     } 
    } 
    }, 
    "transactions": [ 
    { 
     "amount": { 
     "total": "10.00", 
     "currency": "USD", 
     "details": { 
      "subtotal": "10.00" 
     } 
     }, 
     "item_list": { 
     "items": [ 
      { 
      "name": "Apples", 
      "price": "10.00", 
      "currency": "USD", 
      "quantity": "1" 
      } 
     ], 
     "shipping_address": { 
      "recipient_name": "John", 
      "line1": "441 Waterdale RD", 
      "city": "Heidelberg West", 
      "state": "VICTORIA", 
      "postal_code": "3081", 
      "country_code": "AU" 
     } 
     }, 
     ..... 
} 

如果您沒有看到這一點,我會伸出手來Paypal's Technical Support並提交故障單。因爲這是你應該得到的迴應。

0

您需要創建一個體驗配置文件,並將address_override選項設置爲1.客戶將無法更改您傳遞給PayPal的運送地址。

啓動銷售時,您會在您的JSON請求中包含experience_profile_id。

相關問題