I am a little bit confused, somehow I am able to change the amount of the purchase:
First I setup my purchase,
#setup_response = gateway.setup_purchase(
10*100,
:ip => request.remote_ip,
:return_url => url_for(:controller => "payments", :action => 'confirm', :only_path => false),
:cancel_return_url => url_for(:controller => "payments", :action => 'error', :only_path => false),
:currency => 'EUR',
:email => current_user.email,
:no_shipping => true,
:items => items
)
Later I do the purchase:
purchase = gateway.purchase(
500*100,
:ip => request.remote_ip,
:payer_id => params[:payer_id],
:token => params[:token],
:currency => 'EUR'
)
As you can see I have changed the amount from 10 -> setup/user agreed to 1000 when purchasing and it did work in the Paypal Sandbox.
I think this is really strange. Can anybody confirm this? This should not happen?
Is this perhaps only possible in the Sandbox?
Pretty sure Paypal Express Checkout does not require the amount at DoExpressCheckoutPayment (which is what setup_purchase maps to) to be the same as that at SetExpressCheckout. To quote Paypal's documentation:
In the simplest case, you set the total amount of the order when you
call the SetExpressCheckout API. However, you can change the amount
before calling the DoExpressCheckoutPayment API if you did not know
the total amount when you called the SetExpressCheckout API.
You are allowed some leeway between the set-up and the purchase - this is to allow people changing their order, discounts, etc.
Don't take the risk of billing people more than you clearly state - Paypal are very quick to give people refunds so you'll end up losing out in the long run.
Related
I am creating the following pay request with the ruby adaptive payment sdk:
fee = 2
api = PayPal::SDK::AdaptivePayments.new
pay = api.build_pay({
:actionType => "PAY",
:cancelUrl => "https://localhost:3000/purchases/paypal_cancelled?purchase_guid=" + self.guid,
:currencyCode => self.currency,
:feesPayer => "PRIMARYRECEIVER",
:ipnNotificationUrl => "http://paypal.corstiaan.ultrahook.com/purchases/paypal_ipn_notify?purchase_guid=" + self.guid,
:receiverList => {
:receiver => [{
:amount => 20,
:email => seller#email.com,
:primary => true
}, {
:amount => fee,
:email => 'ch-facilitator#corstiaan.com'
}],
},
:returnUrl => "https://localhost:3000/purchases/paypal_success?purchase_guid=" + self.guid + "&verification_key=" + paypal_verification_key })
pay_response = api.pay(pay)
Everything works just like I want it to. I am the facilitator of the transaction and secondary receiver and the seller is the primary receiver. This is all ok. Also, the cancel and return urls are being called correctly.
Only the ipnNotificationUrl is not getting hit. I have set up a forward using ultrahook.com which is getting called correctly when using paypal's ipn simulator (that does not support adaptive ipn messages for some reason...) so technically that forward should work, but I never see anything hitting my server...
I am lost in the paypal docs, which are terrible.
When I view the IPN history ch-facilitator#corstiaan.com I only see IPN messages that relate to the payment of the fee from the seller to facilitator, nothing regarding the whole transaction which should be posted to ipnNotificationUrl if I understand correctly up to this point.
What am I doing wrong/what can be the problem? Thanks!
In order to ensure consistent experience i want to set header image and business on paypal's page, view items with their names and description and ask the customer to select shipping address.
I'm using active_paypal_adaptive_payment gem (https://github.com/jpablobr/active_paypal_adaptive_payment) and the option to set_payment_options:
response = ADAPTIVE_GATEWAY.setup_purchase(
:action_type => 'CREATE',
:receiver_list => recipients,
...
)
ADAPTIVE_GATEWAY.set_payment_options(
:display_options => {
:business_name => 'Big Business',
:header_image_url => 'url goes here'
},
:sender_options => {
:require_shipping_address_selection => true },
:receiver_options => [{
:description => _description,
:invoice_data => {
:item => [{
:name => _title,
:item_count => 1,
}],
:total_shipping => 10.0,
:total_tax => 10
},
:receiver => {
:email => email
}
}])
)
The issue is that it doesn't work - i do not see any business names or image, i see generic names on the left column (the one with the items and the flow doesn't ask for shipping address).
Could you please advise?
You can also do so by logging into PayPal, then going to My Selling Tools and update the Custom payment pages option to create a new page style with the color combination and logo of your choice (there are size restrictions for the logo images)
I'm trying to figure out how I can use the Gibbon gem in Rails to automatically add subscribers to specific interest groups in MailChimp?
I've found this article which details a non-Rails method for doing so: http://roman.tao.at/uncategorized/mailchimp-api-listsubscribe-listbatchsubscribe-and-groups/
I'd like to figure out how to implement that functionality using the Gibbon gem: https://github.com/amro/gibbon
FYI, I'm also a novice with both MailChimp and Rails.
Finally, after hours of perusing through code. I've found the example I'm looking for!
Thanks to TJ Moretto for providing this on a Google Groups thread:
I'm using the gibbon gem, but ran into the same types of issues.
Here's how I had to format the parameters to finally get this to work:
gb.list_subscribe({:id => "#{list.id}",
:email_address => user.email,
:update_existing => true,
:double_optin => false,
:send_welcome => false,
:merge_vars => {'FNAME' => "#{user.first_name}",
'LNAME' => "#{user.last_name}",
'GROUPINGS' => {0 => {'id' => grouping.id, 'groups' => "#{challenge.name}"}}}
})
Hope that helps.
Mailchimp Team - based on the number of issues that everyone runs into
when trying to do this (across all programming languages), I suggest
you update the API documentation to be more clear.
Update for version 2.0 of the MailChimp API and version 1.0 of Gibbon (For #Calin and posterity). Here are the necessary changes from the previous version. The API object is accessed like this now:
gb = Gibbon::API.new
And list methods like so:
gb.lists.subscribe(params)
Finally the :email_address parameter has been replaced by the :email parameter, which should be given a value of the following form: The value should itself be a hash with one key, either 'email' or 'leid', and the value should be either the email address of the subscriber or MC's unique identifier (LEID) for the subscriber.
So a full subscription call might look something like this:
gb = Gibbon::API.new
gb.lists.subscribe(:id => "ed6d1dfef4",
:email =>
{ "email" => "example#domain.com" },
:merge_vars =>
{:groupings =>
{
0 => { :id => "95", :groups => ["Some Group", "Another Group"]},
1 => { :id => "34", :groups => ["A Third Group"]}
}
},
:update_existing => "true",
:double_optin => "false",
:replace_interests => "false")
I'm trying to set up a PayPal express checkout using active merchant but I'm running into problems. I've followed a tutorial and I can get to the "choose a way to pay" form on paypal but there are no items or prices displayed.
Here's a screenshot. http://i39.tinypic.com/35mircz.png
Why is not displaying a price or any items even though I'm passing them in? Here is the code I'm using to setup_purchase.
#product = Product.find(params[:product_id])
setup_response = gateway.setup_purchase(200,
:ip => request.remote_ip,
:items => [{:name => "Tickets", :quantity => 22, :description => "Tickets for 232323", :amount => 10}],
:return_url => url_for(:action => 'confirm', :only_path => false),
:cancel_return_url => url_for(:action => 'index', :only_path => false)
)
redirect_to gateway.redirect_url_for(setup_response.token)
Any help would be greatly appreciated.
Alex
Your problem lies with your quantities and pricing - if you output setup_response after it does the call with something like
logger.debug setup_response
And check the log, you'll see that it's probably complaining that the price in the items is not matching up to the amount you're passing (the first value).
At the moment, you have a quantity of 22, with each 'amount' being 10. 10*22 = 220, and since you're only putting in 200 in the first value, you're mis-matching them. Fix that and you should be good to go.
I have encountered the same issue and have finally found the reason, and it is unbelievably stupid. Are you ready?
There is a mismatch between the total price you specified (200) and the sum of your items (22*10=220). If you change your quantity to 20, it will work. Paypal requires that the sum of your items' cost would equal the total price you specify. I have no idea how I realised this.
I am making the paypal application with rails.
I have create all the necessary a/c in http://develpers.paypal.com and also have insert all that information in my rails app.
My problem is when i am trying to authorize my seller a/c, it gives me error like
"Failure: This transaction cannot be processed due to an invalid merchant configuration."
My code is:
# all inforation is of seller API id, password, signature
gateway = ActiveMerchant::Billing::PaypalGateway.new(
:login => "seller_1302505219_biz_api1.gmail.com",
:password => "...",
:signature => "..."
)
options = {
:ip => request.remote_ip,
:billing_address => {
:name => "Name",
:address1 => '1 Main St',
:address2 => '',
:city => 'San Jose',
:state => 'CA',
:country => 'US',
:zip => '95131',
# :phone => '408-983-5678'
:phone => '408-678-0945'
}
}
res = gateway.authorize(amount, credit_card, options)
You need to have a seller account set up with Website Payments Pro.
Create your selling test account using the Preconfigured option.
Under Account Type, select Website Payments Pro.
Good luck!
Got the solution.
I have google it but got the information about the "Billing agreement".
But that functionality is provided in Website Payment Pro.
so I have just create an test account using WPP and use that WPP account credential for transaction.
It works fine.
Cheers!!!
In addition, your account may or may not be enabled for Pro (DoDirectPayment) even after signing up for it in Sandbox. There's a thread on the x.com forums where you can ask one of the support guys to enable it for you.