An invalid merchant configuration in Paypal with rails - ruby-on-rails

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.

Related

PayPal adaptive payments ipnNotificationUrl is not getting hit for app/facilitator

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!

shipping address is not visible in paypal screen while using adaptive payment

I am using PayPal adaptive payment. I want to send shipping address of sender to reciever.
I am doing following things
First I am getting the approval key from sender with Preapproval API
Then, i am using PAY Create API.
This are the paramters
:actionType => "CREATE",
cancelUrl: 'https://www.example.com/paypal_cancelurl',
returnUrl: 'https://www.example.com/paypal_successurl',
:currencyCode => "USD",
:preapprovalKey => preapproval_key,
:receiverList => {
:receiver => [{
:amount => total,
:email => reciever#example.com }] }
After getting paypal paykey from step 2, i am using Set Payment Option API . I am passing following information
:payKey => paykey,
:displayOptions => {
:businessName => "Example Site" },
:senderOptions => {
:shippingAddress => {
:addresseeName => sender_name
:street1 => sender_street,
:city => sender_city,
:state => sender_state,
:zip => sender_zip,
:country => "US"
}
}
Lastly, I am executing payment with Execute Pay API.
Everything is fine but when reciever review this payment in paypal screen, he don't see the shipping address which i sent to him. His paypal screen say that the sender has no shipping address.
I cross checked, fetched the Payment Details with Payment Details API, found that shipping address is there, strange?
What i am missing, why shipping address is not visible in paypal screen.?
Update: all above flow is done on sandbox.I'm not sure this matters but thought to mention it.
The shipping options would have to work in the embedded payment flow, your request payload looks fine, and you would just need to modify the redirection codes with JS lightbox or minibrowers, as per this instruction: How to Create an Embedded Payment Flow Using Adaptive Payments

ActiveMerchant PayPal Express possible bug?

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.

ActiveMerchant Authorize.net ARB and CIM Phone?

I am unable to store phone number to either an ARB or CIM profile. Everything else stores perfect, but phone number won't save. We tried '1111111111' as well. Is :phone not the correct option name? Authorize.net has a field for phone number.
We are using the recurring in ARB:
http://activemerchant.rubyforge.org/classes/ActiveMerchant/Billing/AuthorizeNetGateway.html#M000399
options = {
:billing_address => {
:name => 'Mark McBride',
:address1 => '1 Show Me The Money Lane',
:city => 'San Francisco',
:state => 'CA',
:country => 'US',
:zip => '23456',
:phone => '(555)555-5555'
}
}
Any help would be amazing.
You have phone number in the wrong place. Phone number goes under "customer". Not the billing information. Make sure to read the documentation for the proper syntax for each request.
Sorry delphi but you cannot pass phone number in billing address.

How do I process responses from using the official Chargify gem in Rails 3.

I'm currently developing a Rails application to accept recurring billing using Chargify. I've installed their gem and managed to connect to Chargify with the gem. However, some subscriptions go through and some do not.
My question is how do I handle or even process the response once the gem communicates with the server?
I don't see anything in the development logs that gives me any indication of a successful data transfer or a failed one. The gem documentation also does not mention anything regarding this.
Thanks for looking.
UPDATE
The code I'm playing around with is in my checkout controller:
def checkout
#customer = Customer.new(params[:customer])
Chargify::Customer.create(
:first_name => "Charlie",
:last_name => "Bull",
:email => "charlie#example.com",
:organization => "Chargify"
)
Chargify::Subscription.create(
:product_handle => 'recurring',
:customer_attriburtes => {
:first_name => #customer.shipping_first_name,
:last_name => #customer.shipping_last_name,
:email => #customer.email
},
:payment_profile_attributes => {
:first_name => #customer.shipping_first_name,
:last_name => #customer.shipping_last_name,
:full_number => "1",
:expiration_month => 1,
:expiration_year => 2012,
:billing_address => #customer.shipping_street_address,
:billing_city => #customer.shipping_city,
:billing_state => #customer.shipping_state,
:billing_zip => #customer.shipping_zip_code,
:billing_country => #customer.shipping_country
}
)
#if #subscription.save
# logger.info "saved description"
# redirect_to process_path
#else
# redirect_to :back, :alert =>"There was an error."
#end
end
The customer create is going through, but the Subscription does not. I'm just looking for a callback from the server so I can act based off whether it succeeded and find out why the subscription isn't going through.
Since this whole gem uses ActiveResource cant you just call something like:
# Create a subscription from a customer reference
subscription = Chargify::Subscription.create(
:customer_reference => 'moklett',
:product_handle => 'chargify-api-ares-test',
:credit_card_attributes => {
:first_name => "Michael",
:last_name => "Klett",
:expiration_month => 1,
:expiration_year => 2020,
:full_number => "1"
}
)
if subscription.save
puts "Created Subscription!"
else
puts "Subscription Failed!"
end
and see if the record has been created correctly?
EDIT: Your code should work but I see that the call to save is commented out. When you call save it creates or updates the record and testing this should allow you to determine if your record was created or not.

Resources