如有疑問,請查看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)
具有u看這個鏈接? (https://github.com/paypal/rest-api-sdk-ruby) – sasikkumar