我正在使用Activemerchant
在我的电子商务网站中整合快速结帐。
我在控制器端这样做
def express_checkout
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
login: "MY SANDBOX LOGIN",
password: "MY PASSWORD",
signature: "MY Signature",
appid: "APP-80W284485P519543T"
}
gateway = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
response = gateway.setup_purchase(1000,
ip: request.remote_ip,
return_url: "http://esignature.lvh.me:3000/en/transactions/status",
cancel_return_url: "http://esignature.lvh.me:3000/en/transactions/status",
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: "1", amount: 1000}]
)
redirect_to gateway.redirect_url_for(response.token)
end
它将我重定向到paypal页面,我能够成功地执行交易。但遗憾的是,我无法在卖方或买方方面看到PayPal方面的任何交易。
我的假设是卖家帐户与我使用API凭据的帐户相同。 有没有办法发送收件人信息?任何建议将不胜感激。谢谢你
交易后,它会重定向到status
页面,同时查看交易明细
这是我的输出。
EXPRESS_GATEWAY.details_for(params[:token])
=> #<ActiveMerchant::Billing::PaypalExpressResponse:0x007f81122b6430
@authorization=nil,
@avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
@cvv_result={"code"=>nil, "message"=>nil},
@emv_authorization=nil,
@error_code=nil,
@fraud_review=false,
@message="Success",
@params=
{"timestamp"=>"2015-10-13T06:58:27Z",
"ack"=>"Success",
"correlation_id"=>"591914b738b78",
"version"=>"124",
"build"=>"18308778",
"token"=>"EC-0AB53385410155352",
"payer"=>"vikas@esignature.com.np",
"payer_id"=>"3GHXVQ2K8S5LQ",
"payer_status"=>"verified",
"salutation"=>nil,
"first_name"=>"Vikas",
"middle_name"=>nil,
"last_name"=>"Lamichhane",
"suffix"=>nil,
"payer_country"=>"US",
"payer_business"=>nil,
"name"=>"Order",
"street1"=>"1 Main St",
"street2"=>nil,
"city_name"=>"San Jose",
"state_or_province"=>"CA",
"country"=>"US",
"country_name"=>"United States",
"postal_code"=>"95131",
"address_owner"=>"PayPal",
"address_status"=>"Confirmed",
"billing_agreement_accepted_status"=>"false",
"order_total"=>"12.34",
"order_total_currency_id"=>"USD",
"item_total"=>"12.34",
"item_total_currency_id"=>"USD",
"shipping_total"=>"0.00",
"shipping_total_currency_id"=>"USD",
"handling_total"=>"0.00",
"handling_total_currency_id"=>"USD",
"tax_total"=>"0.00",
"tax_total_currency_id"=>"USD",
"phone"=>nil,
"address_id"=>nil,
"external_address_id"=>nil,
"address_normalization_status"=>"None",
"quantity"=>"1",
"tax"=>"0.00",
"tax_currency_id"=>"USD",
"amount"=>"12.34",
"amount_currency_id"=>"USD",
"ebay_item_payment_details_item"=>nil,
"description"=>"Order description",
"insurance_total"=>"0.00",
"insurance_total_currency_id"=>"USD",
"shipping_discount"=>"0.00",
"shipping_discount_currency_id"=>"USD",
"insurance_option_offered"=>"false",
"seller_details"=>nil,
"payment_request_id"=>nil,
"order_url"=>nil,
"soft_descriptor"=>nil,
"checkout_status"=>"PaymentActionNotInitiated",
"payment_request_info"=>nil,
"transaction_id"=>nil,
"parent_transaction_id"=>nil,
"receipt_id"=>nil,
"transaction_type"=>"none",
"payment_type"=>"none",
"exchange_rate"=>nil,
"payment_status"=>"None",
"pending_reason"=>"none",
"reason_code"=>"none",
"Token"=>"EC-0AB53385410155352",
"PayerInfo"=>
{"Payer"=>"vikas@esignature.com.np",
"PayerID"=>"3GHXVQ2K8S5LQ",
"PayerStatus"=>"verified",
"PayerName"=>{"Salutation"=>nil, "FirstName"=>"Vikas", "MiddleName"=>nil, "LastName"=>"Lamichhane", "Suffix"=>nil},
"PayerCountry"=>"US",
"PayerBusiness"=>nil,
"Address"=>{"Name"=>"Vikas Lamichhane", "Street1"=>"1 Main St", "Street2"=>nil, "CityName"=>"San Jose", "StateOrProvince"=>"CA", "Country"=>"US", "CountryName"=>"United States", "PostalCode"=>"95131", "AddressOwner"=>"PayPal", "AddressStatus"=>"Confirmed"}},
"BillingAgreementAcceptedStatus"=>"false",
"PaymentDetails"=>
{"OrderTotal"=>"12.34",
"ItemTotal"=>"12.34",
"ShippingTotal"=>"0.00",
"HandlingTotal"=>"0.00",
"TaxTotal"=>"0.00",
"ShipToAddress"=>
{"Name"=>"Vikas Lamichhane",
"Street1"=>"1 Main St",
"Street2"=>nil,
"CityName"=>"San Jose",
"StateOrProvince"=>"CA",
"Country"=>"US",
"CountryName"=>"United States",
"Phone"=>nil,
"PostalCode"=>"95131",
"AddressID"=>nil,
"AddressOwner"=>"PayPal",
"ExternalAddressID"=>nil,
"AddressStatus"=>"Confirmed",
"AddressNormalizationStatus"=>"None"},
"PaymentDetailsItem"=>{"Name"=>"Order", "Quantity"=>"1", "Tax"=>"0.00", "Amount"=>"12.34", "EbayItemPaymentDetailsItem"=>nil, "Description"=>"Order description"},
"InsuranceTotal"=>"0.00",
"ShippingDiscount"=>"0.00",
"InsuranceOptionOffered"=>"false",
"SellerDetails"=>nil,
"PaymentRequestID"=>nil,
"OrderURL"=>nil,
"SoftDescriptor"=>nil},
"CheckoutStatus"=>"PaymentActionNotInitiated",
"PaymentRequestInfo"=>nil,
"PaymentInfo"=>{"TransactionID"=>nil, "ParentTransactionID"=>nil, "ReceiptID"=>nil, "TransactionType"=>"none", "PaymentType"=>"none", "ExchangeRate"=>nil, "PaymentStatus"=>"None", "PendingReason"=>"none", "ReasonCode"=>"none", "SellerDetails"=>nil}},
@success=true,
@test=true>