Use Eventbrite API to create ticket order on 3rd party website - eventbrite

Here's my flow - is this possible with eventbrite APIs? if yes, which ones specifically? I've tried looking through current listed apis and don't see how I can create the order and then pass it on to the eventbrite site for processing the order.
I am trying to find an API whereby I would pass-in discount code along with #of tickets and eventID from my website to eventbrite site. Is there a good example for this?
The workflow that I want to implement is:-
Step 1 On My Website, there is eventbrite Ticket Widget button along with Ticket Previews (http://developer.eventbrite.com/doc/widgets/#button) on the event page
Step 2: Clicks on Buy Tickets/Register/ buttons (from the widget)
Step 3: redirect to eventbrite website with eventID, user-elgible-discount-code, #of-tickets-selected-by-user
Step 4: eventbrite system processes the ticket order as specified in the api call (along with price/discount, qty, eventId, etc.) on eventbrite.com site
Any help appreciated.
Thanks,
Jatin

You can leave out the widget altogether and post directly to the EB checkout page.
For example:
<form action="http://www.eventbrite.co.uk/orderstart?ebtv=C" method="post">
<input type="hidden" name="eid" value="[EVENT_ID]">
<input type="text" name="quant_[TICKET_ID]_None" value="[QUANTITY]" />
<input type="text" name="discount" value="[DISCOUNT_CODE]" />
<input type="hidden" name="has_javascript" value="1">
<input type="submit" />
</form>
I wouldn't have thought this method is officially supported but it seems to work at the moment.

Related

Paypal select amount for Hosted Donation button in rails 4

I am working on rails 4 application. I need to give payment options for Donation button.
I need to create radiobutton as well as textbox to enter amount of payment for Donation.
My code is
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxxxxxxxxxx">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Here I enter value of amount field by jQuery (code is not posted) so it is not empty ("").
But on the second step the amount I submit in hidden field is not shown.
I google it some people say one can not enter amount on hosted button means it would be fixed every time.
Some people say create the buy now button reference => https://www.paypal.com/webapps/mpp/get-started/donate-button-text-field
What should I do is it possible with hosted button?
Should I change my code ?
Whenever you use the PayPal hosted buttons you can't change the amount related information. Hosted buttons are secure in the terms that nobody can fiddle with the amount. Changes to the amount for hosted buttons can only be done thru account or via API's . If you are implementing a solution where you need to change the amount dynamically you should consider using the clear text button or You can dynamically generate the encrypted using the API's
However the variables related to :address ,cancel/return/image/ipn url ,item name/invoice id/custom/quantity can be overridden by passing the variables for hosted buttons.

How rewrite URL?

I'm making a single web app.
I have a form with a POST method and an action value equal to "/login".
<form action="/login" method="POST">
<label for="mail">Email</label><input name="log" id="mail" type="text">
<label for="pass">Pass</label><input name="pass" id="pass" type="text">
<input type="submit">
When the submit button is press, server get the form, then return to the index page.
But, in the address bar, I have "local:5050/login" and would have "local:5050".
Can I remove the "login" mention ?
Since you are making a SPA, you will not want to have the POST method of the form actually complete. Generally this is done in dart by attaching a listener on the form element, within that listener you would then do a couple of things:
1) Cancel the default action (Also see: How do I prevent an on.submit event from changing/reloading the page?)
2) Get the values you're interested in from the form (or potentially take the entire form itself)
3) Send the values via an AJAX request to the server and listen for the response from the server to verify it was valid etc.
See the Dart tutorials on forms for more information on accomplishing the other steps.

PayPal how to set the subtotal attribute from the application

I'm developing a web application based on JSF 2.0. The application automatically generates a quote to sell a service so, the subtotal it's not predictable.
I would like to integrate PayPal Payments but I need to set the subtotal value in a dynamic way. I succeeded in doing payments of a fixed amount through the payPal sandbox using the standard integration of the HTML button. I also tried to add to the form that contains the generated button the subtotal value but it doesn't seem to work.
Something like:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick"></input>
<input type="hidden" name="hosted_button_id" value="3V8S6DNHUQ58C"></input>
<input type="hidden" name="subtotal" value="88"> </input>
<input type="image"
src="https://www.sandbox.paypal.com/it_IT/IT/i/btn/btn_buynow_LG.gif"
name="submit"
alt="PayPal - Il metodo rapido, affidabile e innovativo per pagare e farsi pagare."></input>
<img alt="" border="0"
src="https://www.sandbox.paypal.com/it_IT/i/scr/pixel.gif" width="1"
height="1"></img>
</form>
Is there a way to set subtotal value from the application with HTML standard integration, preferentially getting the value from a bean property?
Do I have to use a more advanced way for the integration? Thanks for help, as usual.. :)
The button you're currently using is a hosted button. As such, you cannot dynamically adjust it the way you want to.
You would have to edit your button and disable the "save at PayPal" option in order to make it a non-hosted button. This way you would have direct access to the actual request parameters and you could adjust their values accordingly.
That said, it's not very secure because then users can see your button code, copy it, and adjust it before making a payment with it.
I would recommend you use the Express Checkout API instead. This consists of SetExpressCheckout, GetExpressCheckoutDetails, and DoExpresscheckoutPayment. This is a little bit more involved because you're working with web services, but it opens you up to customize it however you need and is secure.

Active Merchant Integrations (off site payments) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
My original question (below) was perhaps too specific, so I'm going to ask something more general!
Can anyone point me in the direction of a tutorial, example or documentation on using Active Merchant Integrations to support an offsite payment gateway?
Active Merchant's rdoc lists all of the following as supported offsite payment gateways but I haven't found any tutorials or examples on how to use ActiveMerchant::Billing::Integrations
2 Checkout
Banca Sella GestPay
Chronopay
Direct-eBanking
DirecPay
HiTRUST
Moneybookers
Nochex
PayPal Website Payments Standard
SagePay Form
Valitor
WorldPay
As good as they may be, peepcode and rails casts only consider gateways, not integrations.
Many thanks!
My company is moving from PayPal Express Checkout to WorldPay Business
Gateway (Hosted Payment Page). We're using Rails and Active Merchant.
Does Active Merchant support WorldPay Business Gateway (Hosted Payment Page)? I think it does, judging by the rdoc
What arguments must I supply to ActiveMerchant::Billing::Integrations::WorldPay.new ?
Thanks
I made a simple app to demonstrate how off-site payments for Worldpay and Rails/Activemerchant can work together.
Demo Rails App-
https://github.com/daemonsy/Worldpay-Rails--Off-Site--Integration-Example
For World Pay hosted payment, basically a post to their payment URL is required. Add test- to secure.worldpay.com for testing mode. WP requires amount, currency, installation ID and cartId to render the page to the customer.
<form action="https://test-secure.worldpay.com/wcc/purchase" method=POST>
<!-- This next line contains the testMode parameter - it specifies that the submission is a test submission -->
<input type="hidden" name="testMode" value="100">
<!-- This next line contains a mandatory parameter. Put your Installation ID inside the quotes after value= -->
<input type="hidden" name="instId" value="Your installation ID ">
<!-- Another mandatory parameter. Put your own reference identifier for the item purchased inside the quotes after value= -->
<input type="hidden" name="cartId" value="Your ID for the product ">
<!-- Another mandatory parameter. Put the total cost of the item inside the quotes after value= -->
<input type="hidden" name="amount" value="The cost of the product ">
<!-- Another mandatory parameter. Put the code for the purchase currency inside the quotes after value= -->
<input type="hidden" name="currency" value="currency code e.g. GBP, USD ">
<!-- This creates the button. When it is selected in the browser, the form submits the purchase details to us. -->
<input type=submit value=" Buy This ">
Source: http://www.worldpay.com/support/kb/bg/htmlredirect/rhtml.html
This creates a simple button that carries your order to World Pay where the customer will enter credit card details and complete the purchase. I've embedded the above code in the show page of an orders controller. e,g, <input type="hidden" name="amount" value="<%=#order.amount"%>>. So you can click buy this after submitting the order. There are many ways to achieve a POST to World Pay.
After which, World Pay can show a shopper response page, send you payment response etc. For payment response to work, you can setup the payment response callback URL to one of your controllers. e.g. =>http://mysite.com/payment-backend
This will be a POST request so you have to setup your controller to handle it. This is where Activemerchant kicks in. For example,
class BackendsController < ApplicationController
include ActiveMerchant::Billing::Integrations
protect_from_forgery :except=>[:worldpay_return]
#in routes => match '/payment-backend'=>'backends#worldpay_return'
def worldpay_return
notification = WorldPay::Notification.new(request.raw_post)
order = Order.find(notification.item_id)
if notification.acknowledge
begin
if notification.complete?
order.status = 'success'
end
rescue
order.status = "failed"
raise
ensure
order.save
end
end
render :text =>"Order status for #{order.id} is #{order.status}"
end
end
So the Notification object will read the params in request.raw_post and set them up the an object where you can query. I found the active merchant docs useful in telling what return params are mapped by it.
Note that this controller is a very crude example. World Pay provides a few methods for you to validate the response and this is supported by Active Merchant.
ActiveMerchant Docs on WorldPay::Notifications
http://rdoc.info/github/Shopify/active_merchant/master/ActiveMerchant/Billing/Integrations/WorldPay
World Pay Payment Response Docs
http://www.worldpay.com/support/kb/bg/paymentresponse/payment_response.html

How do I create a Up/Down voting system like stackoverflow?

I'm making a site in Rails, and I want to add a vote up/down system like here in Stackoverflow.
Can anyone suggest how to do it? I do know that I'll enter each vote into the database, but I mean, how do I code the vote buttons? What will I use, can anyone help me. Ajax isn't required but it would be nice.
I was going to try to use a POST command and do something like this,
<form name="input" action="/grinders" method="POST">
<input type="hidden" name="id" value="<%=h grinder.id %>">
<input type="hidden" name="vote" value="up">
<input type="submit" value="Vote" />
</form>
But, I get an authenticity token error, and I honestly do not know how to work with the form helper.
Have a votes table like so:
[PK] vote_id, vote_type (up/down), [FK] post_id, [FK] user_id, time [optional]
Also add a score field to your posts table
Then you could have the vote button access a link like: /vote/post_id/type/, eg: /vote/14098/up. This can be done with or without Ajax.
When the vote action is called, check if the user has previously voted on that post - if yes, deny it. If not, create a row with the relevant values in the votes table and update the score field in the posts table.

Resources