使用paypal rest api付款,并返回payId& payer_id,但我的paypal帐户中没有付款记录,如何使用paymentId或payer_id查询详细信息,我的开发sdk是ruby。
这是代码
def paypal_service booking
house = booking.house
house_info = "#{house.house_type} - #{house.category}"
@payment = Payment.new({
:intent => "sale",
:payer => {
:payment_method => "paypal" },
:redirect_urls => {
:return_url => "#{@app_url}/bookings/#{booking.out_trade_no}/return",
:cancel_url => "#{@app_url}/bookings/#{booking.out_trade_no}/cancel" },
:transactions => [{
:item_list => {
:items => [{
:name => "#{house_info}",
:sku => "xxx-#{house.id}",
:price => "1", #todo just for test
:currency => 'USD',
:quantity => 1 }]},
:amount => {
:total => "1",
:currency => 'USD' },
:description => house.title }]})
if @payment.create
@redirect_url = @payment.links.find{|v| v.method == "REDIRECT" }.href
logger.info "Payment[#{@payment.id}]"
logger.info "Redirect: #{@redirect_url}"
return @redirect_url
else
logger.error @payment.error.inspect
end
end