2014-05-12 35 views
0

寶石'貝寶SDK-商人集送貨地址(在軌道上的Ruby)

@api = PayPal::SDK::Merchant::API.new 
params = {:SetExpressCheckoutRequestDetails => payment_params.merge({ 
     :ReturnURL => return_url, 
     :CancelURL => cancel_url, 
     })} 
@set_express_checkout = @api.build_set_express_checkout(params) 

我需要送送貨地址到PayPal。

如何在params中設置送貨地址?

+0

具有u看這個鏈接? (https://github.com/paypal/rest-api-sdk-ruby) – sasikkumar

回答

0

如有疑問,請查看github SDK page上的樣品。

我發現這個例子:

set_express_checkout: 
    SetExpressCheckoutRequestDetails: 
    PaymentDetails: 
     PaymentAction: Sale 
     TaxTotal: 
     currencyID: USD 
     value: 0 
     ShippingMethod: UPSGround 
     ShippingTotal: 
     currencyID: USD 
     value: 3.0 
     PaymentDetailsItem: 
     Name: Item Name 
     Amount: 
      currencyID: USD 
      value: 5.27 
     Quantity: 1 
     ItemCategory: Physical 
     ShipToAddress: 
     Name: John Doe 
     Street1: "1 Main St" 
     CityName: San Jose 
     StateOrProvince: CA 
     Country: US 
     PostalCode: "95131" 

這使我相信正確的方式做這將是:

@api = PayPal::SDK::Merchant::API.new 
    params = {:SetExpressCheckoutRequestDetails => payment_params.merge({ 
      :ReturnURL => return_url, 
      :CancelURL => cancel_url, 
      :PaymentDetails => { 
       :PaymentDetailsItem => { 
        :Name => "Item Name", 
        :Amount => { 
         :currencyId => "USD", 
         :value => "1.27" 
        } 
       }, 
       :ShipToAddress => { 
        :Name => "John Doe", 
        :Street1 => "1 Main St", 
        :CityName => "San Jose", 
        :StateOrProvince => "CA", 
        :Country => "US", 
        :PostalCode => "95131" 
       } 
      } 
     } 
    )} 
    @set_express_checkout = @api.build_set_express_checkout(params) 
+0

謝謝)))這項工作=) – FrozFox