Google Wallet Multiple Buttons on 1 Page - JWT & Callback - php

I am adding Google Wallet for Digital Goods to my simple Wordpress website. I have 5 products and do not mind if they need to be purchased one at a time (like Google Checkout). However, I am stumped with JWT.
I have downloaded the Sample App for PHP at https://developers.google.com/wallet/digital/docs/samples#iap-php and have identified the basics of changing my seller information as well as changing my first product (instead of the cake demo).
I still haven't figured out how to add more than one Buy Now button on a page. I assume that I need to add another payload in generate-token.php but cannot find any documentation on that. I sure hope someone with JSON/JWT could help me over this hump.
Another issue is creating a callback for each that allows me to redirect the buyer back to my website with the link and password to the download page. At this point, I'd appreciate answers to one of these 2 issues or both. Thank you in advance!

For each button on your web page you will generate a different JWT as the "name", "description", "price" and "sellerData" is different for each item:
https://developers.google.com/wallet/digital/docs/tutorial#1
You can set only one postback URL. The postback data will contain the JWT for the item purchased which allows you to determine what was sold. You can also place additional item information in the "sellerData" field:
https://developers.google.com/wallet/digital/docs/tutorial#5

Related

Paypal - Selling a digital product attached to a specific user?

I'm confused by the array of Paypal APIs and options out there. Can someone help me to identify a good starting point for a virtual/digital product option that can have some custom meta data associated with it? Here are my requirements:
I'm selling in-app credits/currency
I'm using PHP to integrate with Paypal
Each purchase must be able to attach some data (for example, a user ID and a product ID from my database) that will be passed back to me so I can identify which user purchased which product, so once it is verified with Paypal, I'll know how to give the digital product to the buyer.
I assumed that "Digital Goods for Express Checkout" would do the trick, since it seems designed for online/virtual/digital types of products. However, I'm having trouble finding a way to pass through the user ID and product ID with this option. I also looked at the example and library at https://github.com/thenbrent/paypal-digital-goods-php-examples but I don't see an obvious way attach this dynamic meta data.
Thanks for any help!
Actually you only want one id. Nothing more is needed. Before processing the order, you bind the id with your meta data (in a database like MySQL).
Then in the listener you can pull out the data using the id.
Hope it helped

PayPal Digital Goods: How to get item number after purchase made?

I got a simple Digital Goods Checkout to work in Sandbox mode. I have a "Pay with PayPal" button that I can click which pops up an window for logging into PayPal. After that it redirects me to my purchasemade.php script, and from there I can successfully download a file.
My problem is that on my website I'm going to sell many products, so I need to know which product they want to download when they finish the purchase. Each product has a unique ID, so I thought I'd pass that ID as the item number in the HTML form as a hidden field named "item_number". However, I don't know how to read that value once I reach the purchasemade.php.
How do I read values passed in POST in the original form? Otherwise, what's the best way of identifying a product? I'm using PHP as my scripting language for this project.
If you're going to stick with Payments Standard I would recommend using IPN to deliver your digital goods. You could use PDT (which is very similar to IPN) to send order data back to the page the user gets redirected to, however, there is no guarantee they will make here even with Auto-Return enabled in your PayPal account.
Alternatively, you could use the Express Checkout API instead of Payments Standard. This method guarantees the user will make it back to your site prior to completing payment. This will allow you to utilize session variables so you can present the download to the user on the thank you/receipt page.
Still, though, I think IPN would be your best bet regardless of which way you go. You can use it to auto-deliver the digital goods, send out general email notifications, update your database, hit third party web services, etc. all in real-time.

Alternative to iframe for giving purchaser information and allowing purchaser to input whether item was bought on another website?

I need some help and out-of-the-box thinking, because I'm genuinely stumped.
I'm making a gift registry website (like for wedding registries). The idea is that the person making the gift registry can add items from anywhere on the web (say, target.com). Then, when someone wants to buy them an item off the registry, they come to our website, find an item, click on the link and are taken to the product page (on target.com) and buy the gift.
The problem is that we need to know if the product was actually purchased so the gift isn't purchased multiple times. Also, we need to give the purchaser the address of the person for whom they're buying a gift.
Here's what we'd like to do:
Unfortunately, the only way I can think of how to do this is through an iframe, which doesn't work with many large retailers (like Amazon and Wal-Mart), which have blocked iframes for legitimate security reasons. Another option is opening two new browser windows, but that's just ugly.
So, what else can I do? Any brilliant JavaScript/css/php or whatever solutions out there?
you can't reliably detect if an item was purchased if it can be any shop in the web. you can only detect if somone clicked a link to the item in the shop but not if he buys it.
you should rely on the user to mark the item as bought.
Your only option, albeit a poor one, is a Bookmarklet. The buyer would have to add/install the bookmarklet before they began shopping. After they complete an order they would have to run the bookmarklet on the order confirmation/receipt page to "verify" the purchase.
You would have to write code for every merchant you support. Anytime the merchant changes their confirmation/receipt page you would have to update your verification script. The bookmarklet would determine the merchant from the page URL and check the page for specific elements to determine which product was purchased.
I would use the bookmarklet as an optional step since you can't assume your users will remember to use it or even know how to use it. I would mark items as "Unverified Purchase" when they choose a product from your list, then mark it as a "Verified Purchase" if the bookmarklet is used. You can also make your bookmarklet verification work on "order history" pages for users who forget to use the bookmarklet during the checkout process but still wish to verify their order.

Passing variable values over to paypal's cart for payment

I have created a basket where a user can add to and update etc. This basket has been built based on what product the user adds to cart obviously. The product itself is grabbed from the database and displayed in a table in the basket. How do I use Paypal from here? I now want a button called 'pay' that the user can click and then it takes them to Paypal to pay. But I want the details of the items to be displayed in Paypal.
I have signed up to paypals web standard payment. Obviously I don't need their add to cart buttons since I have got my own cart. I think I just need the buy button but as mentioned, I am not sure how to get products over to Paypal.
Can somebody explain what I need to do please
This broad of a topic is generally best suited with a quick Google search. Basically, find a paypal form (perhaps through Paypal's button builder) and edit the form's values to suit your needs. This can be accomplished with php or javascript quite easily (PHP is a bit safer as it limits tampering). Then users send the form :)
You can also create a link such ashttps://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$business which will do the same as the full form (add all of the fields you want to send, of course).
Give it a shot - if you have more specific questions, post back with clarifications.

Custom VirtueMart Options

I'm working on a project that ties into an API and uses virtuemart. Basically a user can buy time for a phone card. the few things I need help with are:
A) can/how can I create a custom php function once the user signs up. For instance, the user adds Items to the cart and proceeds to checkout. once the user clicks checkout they need to create an account, after they create an account is there an area in this process that allows for a custom function so that I can tie the creation of the account to an API?
B) same as above but after checkout. After the checkout goes through, how can I make it so the new values are sent to the API? Is there an area in the files that allow for custom functions here.
C) Lastly is it possible to add more options the the virtuemart customer account maintnance screen. I want an option that will tie into the API and show them exactly how much time the have left for their phone card. This information will be provided by the api.
All of these things can be achieved with a System Plugin. You would simply look for the right url, get any information from the result screen with regex, call your API and insert any changes back into the screen.
I'm not specifically aware of any VM functions for this, but as VM is in flux with Version 2 getting closer, it may not be a good time for any such investment in any case.

Categories