I'm working with an external analytics app that requires us to collect email on the /cart page. To save the customer from having to enter their email address again, I'm wondering if there's a way to send that email to the payment form.
You can use the Shopify API to interact with orders, specifically looking at the API documentation you should be able to achieve what you want.
Which language do you code in?/Can you code in?/Would you like to achieve this in? (For example, Ruby, PHP, ASP..)
You can access a users email address from the Order if you know the Order ID..
The Order ID can be found by querying the Shopify orders API based on whatever your criteria are.
Alternatively as per Csaunders answer you can use a Shopify Web-hook which will notify your server when a specific event happens - think of it as an event trigger.. For example:
Customer raises an order
Shopify notices your shop has a web-hook active and so uses it
Your web-system receives all of the order info over a POST request in XML format
You extract the Email address (for example $email = trim($xml->email); )
Push the $email you extracted to whatever your analytics system is
Without further info about your case and setup and what knowledge you have I will struggle to improve this answer - if however you come back and add some more detail or comment on this post I will try to help as best I can.
Thanks
Related
I am implementing subscriptions to a premium service on a website using Paypal as the payment service. I have successfully created a Catalog Product and Billing Plan through the API, and I am able to get to the payment page on Paypal, but it's not clear how I'm supposed to persist a user identifier through the purchase process.
I assumed it would be something along the lines of passing a user id somewhere, but there's nothing in the Paypal documentation about this. I need to be able to let the user make a purchase and have the Paypal webhook send the confirmation to an endpoint on my site, and that's where I'd expect to get their user id to toggle the subscription on their account on my end.
Is there something I'm missing? There has to be a way to do this cause I'd imagine it's a pretty common use case. If anyone has information or has done this before, I'd love to hear. Thanks.
The only truly secure way I've found when using javascript SDK, is to securely generate a unique custom_id on your server side associated with the user.
Then when you create the buttons, the 'createSubscription' function takes custom_id as a parameter.
Then use a webhook to receive events from your subscription and the custom_id will be present in the body of all BILLING.SUBSCRIPTION events under resource.custom_id.
I am able to get to the payment page on PayPal,
You are vague about what you are doing here. There are multiple ways (and some ways have multiple versions) of accepting subscriptions via PayPal, so it is important that you provide full details about the method you are using.
The time to associate a created subscription ID with a user ID is when it is approved, in the onApprove function if you are using a Smart Payment Button: https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription
I'm using Paypal rest api to make payment
the workflow is:
Create payment
Redirect to approval Url
User approved (return back to my site)
Execute payment
But there's one thing that I don't want users re-filling shipping address again because it was filled in my website.
So I change the workflow to:
Create web profile (set no shipping field)
Get web profile ID
Create payment with experienceProfileId given
Redirect to approval Url
User approved (return back to my site)
Execute payment
But I found this will create a lots WebProfile every time user request payment.
I think it is crazy to do:
create and delete it later again and again
attempt listing WebProfiles and check which is the one I want to use every time while creating payment
store experienceProfileId as a constant
What is the best practice for handling WebProfile or does there any solution just hiding shipping address while user approving payments?
Maybe this is not the answer regarding this "WebProfile". As a fact, I dont know what exactly "WebProfile" does or is.
I worked on the same Workflow these days. As you wrote I needed to predefine some address. For me it was obvious, that I have to do the database-stuff on my Website. Then I exactly define the order, shipping_address, etc. and send the users to Paypal.
If you predefine the new ShippingAddress() to your ´new ItemList()´ by
$itemlist->setShippingAddress($shippingaddress) the user cannot change it within the Process.
http://i.imgur.com/nAg8jxU.png
Maybe this helps you a little.
I am new to PayPal API, so I have a nooby question.
When I send user from my shopping site to PayPal payment page e.g. https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxx&custom=xxxx and I use custom variable with unique ID about product inside my database and when user get returned back to my website thank you page, do I use simple $_GET["custom"] inside my php script to grab that value or I need some PayPal API code implemented inside my website?
Thanks for help.
In order to retrieve this value, you would not be able to get it as you described, however, you can do one of a couple of things:
post the custom value to a cookie or session variable before sending the user to paypal, then retrieving the cookie or session variable value when they are returned from paypal.
(preferred method) implement an IPN listener that will be able to parse the posted transaction details, one of which is the custom value. This method would allow you to confirm a completed transaction as well as do pretty much anything else with the data that you need to do.
Paypal has PHP code samples for an IPN listener on their DEV site. It's pretty easy to implement and follow along.
I hope this helps.
Old thread I know but if I understand the user correctly and he is using the IPN url to collect the returned data he can use $myphpvar = $_POST[custom];
More info # http://www.brianmoreau.com/articles/paypal_buy_now_button_sending_custom_variables.php
I am trying to set up a Shopify store to just handle the payment stuff (checkout). I seem to be able to do everything I want through the API, so users only go to Shopify for checkout.
I used these instructions to send users directly to the Shopify checkout once they are ready:
http://www.shopify.com/technology/4849802-new-feature-cart-permalinks
On that page it says "tracking parameters can be added", but I can't find any further explanation about that anywhere. My problem is that once users are sent to the checkout page, there is no way to track them as far as I can tell. I have my own user accounts. I would like users to be able to see their orders. Is that possible?
You can register to receive webhook notifications whenever an order is placed. The notification will include the user's info (name, email, shipping and billing addresses) along with details of the items they purchased.
If your users have an email associated with their account you can match that with the one on the order and track it that way.
+1 on using webhooks. If you are using the Ruby version of the API I'd like to suggest that you use Sinatra to create a simple endpoint for your webhook to talk to. Something like this should get you started:
require 'sinatra'
post '/webhooks/orders/create' do
puts request
puts request.body.read
end
You can run it like so (assuming you save the script to my_sinatra_test.rb):
ruby my_sinatra_test.rb
And then test it from another terminal with curl:
curl -d "foo=1" "http://localhost:4567/webhooks/orders/create"
Once you get your head around this go ahead and create a Shopify web hook for Orders/Create and configure it to talk to your sinatra app. Have fun!
I am trying to find a way of sending email invoice via google checkout's API (and also in PayPal)
I can't find how. or at least how to generate a new order (money request)
thank you
From: http://code.google.com/apis/checkout/developer/Google_Checkout_Comparison_Part_I.html
Requesting Payment by Email Invoices
What is it? Email invoicing lets you sell without an online store. Buyers can place orders from you by phone, fax, email or other offline means; then you send email invoices from the Merchant Center to the buyers requesting payment. Email invoices contain a personalized message from you regarding the requested payment as well as a "Pay now through Google Checkout" link. When buyers click this link, they are brought to Google Checkout where they can complete the payment process.
Best for: Use this option if you don't have or need an online store.
Time required: There's no setup — just open a Google Checkout merchant account and you can immediately start sending invoices.
Technical skills required: None. Just Internet access.
Demo: Email Invoice and Wizard (requires sign-up)
Processing Orders: (Part II) Once orders start coming in, use the Merchant Center to charge orders and update order status.
Next Step: How to request payments by email invoices
From what I've seen, looks like they don't have a way to do this through an API. Hopefully someday they will, but for now I think I'll have to create my own email with a link to my own page that sends them to google checkout via a custom Buy It Now button.
It's too bad - it'd be so simple to just be able to call send_email(name, email, amount, message) and have it be the same as logging in & doing it through the Merchant Center.
I do understand the rationale a little - if you're capable of creating an automated invoicing system that can call a google API to send emails, then you should also be capable of creating a link, custom button, and letting the user checkout that way. I still want it though - I'm lazy.
Can you submit the form data in the way that the google checkout portal does? then it would authenticate and autofill the form?