Skip to content

Instantly share code, notes, and snippets.

@leofrozenyogurt
Last active January 28, 2016 22:44
Show Gist options
  • Save leofrozenyogurt/ad4f7db4a0e9aef47696 to your computer and use it in GitHub Desktop.
Save leofrozenyogurt/ad4f7db4a0e9aef47696 to your computer and use it in GitHub Desktop.
c.http_post(c.url,
Curl::PostField.content('USER', "jb-us-asdasdad.paypal.com"),
Curl::PostField.content('PWD', "asdasasdad"),
Curl::PostField.content('SIGNATURE', "sig"),
Curl::PostField.content('METHOD', "SetExpressCheckout"),
Curl::PostField.content('VERSION', 95),
@cart_product_by_user.each do |product_hash|
Curl::PostField.content('PAYMENTREQUEST_0_ITEMAMT', product_hash.value ), #The amount authorized
Curl::PostField.content('PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID', product_hash.value)
end
Curl::PostField.content('PAYMENTREQUEST_0_PAYMENTACTION', "Sale"), #Sets up authorization for a single future payment
Curl::PostField.content('cancelUrl', "http://localhost:3000/dashboard"), #For use if the customer decides not to proceed with payment
Curl::PostField.content('returnUrl', "http://localhost:3000/dashboard") #For use if the customer proceeds with payment
)
@radar
Copy link

radar commented Jan 28, 2016

payment_requests = @cart_product_by_user.map do |product_hash|
  [
    Curl::PostField.content('PAYMENTREQUEST_0_ITEMAMT', product_hash.value ),    #The amount authorized
    Curl::PostField.content('PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID', product_hash.value)   
  ]
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment