Setting business name and header images with adaptive payments on paypal - ruby-on-rails

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)

Related

Invoce (option) parameter is not working for authorize .net through active merchant

I am trying to charge for Authorize .net Gateway using active merchant gem.
Here is the link for gem
- https://github.com/activemerchant/active_merchant
I am sending email,invoice,description,billing_address, shipping_address as option parameter and transaction is successfully done also but when I see the transaction detail, I found every parameter on authorize .net other than invoice number.
here is my code for option -
options = {:email => "sunil#gmail.com",:invoice => "INV-12345",:description => "Amount 50 for INV-12345",:billing_address => { :name => "Sunil Kumar", :address1 => "9888 America Ave. NW",:city => "Oakland", :state => "AK",
:country => "United States", :zip => "94605",:phone => "1234567890"}}
While charging we are using below code -
gateway.purchase((amount*100), creditcard,options)
Now after successful transaction when I see the transaction detail I found every thing other than Invoice#.
Please suggest if any thing left.
You need to change invoice to order_id. so your code would look like.
options = {:email => "sunil#gmail.com",:order_id => "INV-12345",:description => "Amount 50 for INV-12345",:billing_address => { :name => "Sunil Kumar", :address1 => "9888 America Ave. NW",:city => "Oakland", :state => "AK",
:country => "United States", :zip => "94605",:phone => "1234567890"}}
Here is the code from ActiveMerchant.
def add_invoice(xml, options)
xml.order do
xml.invoiceNumber(truncate(options[:order_id], 20))
xml.description(truncate(options[:description], 255))
end
# Authorize.net API requires lineItems to be placed directly after order tag
if options[:line_items]
xml.lineItems do
options[:line_items].each do |line_item|
xml.lineItem do
line_item.each do |key, value|
xml.send(camel_case_lower(key), value)
end
end
end
end
end
end
https://github.com/activemerchant/active_merchant/blob/master/lib/active_merchant/billing/gateways/authorize_net.rb

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

How do you use the Gibbon Gem to automatically add subscribers to specific interest groups in MailChimp?

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")

An invalid merchant configuration in Paypal with 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.

Resources