How to setup payments using PayPal

A few people have asked me how I’ve setup PayPal on my site so I thought I’d post the info here. This is for single item purchases transacting on the PayPal website, I haven’t tried the PayPal shopping basket features.

To pay using PayPal you can just send the product information using a simple HTML link, you can replace all the values with dynamic variables (use the “go to page” workflow in Bubble), here’s an example

https://www.paypal.com/nz/cgi-bin/webscr?cmd=_xclick&business=myemailaddress%40gmail.com&currency_code=NZD&image_url=https://static.e-junkie.com/sslpic/169377.jpg&item_name=NewShoes&amount=5

You can of course send more information to PayPal such as shipping info and return page URL’s, all the variables are listed here

If you don’t need to get a confirmation back from PayPal then that’s all you need to do, but if you do want payment confirmation and buyer information back in to Bubble then carry on.

Essentially what we’re doing is sending sales info to PayPal, Payment confirmation from PayPal to Zapier and then Zapier back into Bubble. You’ll need a Zapier Basic account which is $20, then just make a new Zap, there’s a built in Successful Sale Zap ready to go.

Trigger
Zapier will give you an IPN URL which you’ll need to put into the Selling Tools section of PayPal.


Zapier will ask you test this step to make sure it works

Action
Where it says choose Action App select Webhooks by Zapier
Under Action select POST
Next setup the Webhook.
The URL field needs to match an API Endpoint you’ll soon setup in Bubble
The Authorization code is the API token generated from the API tab in Bubble settings (setup a new token called Zapier to Bubble)
You can choose what data you want back from PayPal, Zapier will give you a list of all possible PayPal fields


Finally before you test this in Zapier create the API Endpoint in Bubble (you’ll need to be in the API Workflows page). For Key use the same names as you did in Zapier.

You can then access all this info from the Bubble actions as well save the payment confirmation and payer name and address to Bubble and send out an email confirmation if required.

Hope this helps!

10 Likes

Great tutorial! Thanks so much Dru! :slight_smile:

2 Likes

Awesome tutorial

Is there a way to do this without Zapier? I mean, using only Bubble features?

5 Likes

Probably a bit late, but for anyone checking out this thread in 2018, @copilot released a Paypal plugin that processes payments which can be accessed here: https://cobubble.com/paypal

Hey Marcus, I tried this plugin, it didn’t work for me…

But I found out how to set the IPN endpoint in Bubble without Zapier. You just need to add an endpoint in the API workflows, Detect data automatically, and request. The URL given by Bubble is the one you must set on your Paypal’s account under IPN settings.

Pretty simple :slight_smile:

3 Likes

Hey @lupenhacarvalho,

Can you elaborate on what exactly didn’t work for you in an email to plugins@cobubble.com? :slight_smile:

@marcusandrews Thanks for the shoutout!

1 Like

Thanks, finally managed to set up payments for a page on my site, ironically about PayPal payments

https://www.topcoincryptocurrency.com/buy-cryptocurrency-with-paypal/

@topcoincryptocurrenc please provide steps on how you achieved setting up PayPal.

@lupenhacarvalho please provide steps you followed. Really struggling here.

Hi @Adamska sorry I didn’t reply sooner. My website is off, I haven’t working with it for ages…
Anyway, I’ll try to detail what I have done, I hope this can help you.

First Step: 1. Create an Endpoint in API Workflows

image

Click on Detect Data
Bubble will give you an URL, you should copy that

Second Step: IN YOUR PAYPAL ACCOUNT

Go to your vendor profile and activate an IPN and paste the URL

NOTE: This URL will be different for you Development and Live app/website versions. So you must remember to change it when going Live.

Third Step: BACK IN BUBBLE API WORKFLOW

Make changes to User
Search for Users: first item
Create a field
Status subscription: Request Data’s txn_type

image

Forth Step:

Create a new thing (i.e. Status Subscription)
Set your requests, but always ask for user’s e-mail, Data txn_type (here you’ll see if the user has payed or not and if he/she has cancelled the subscription in PayPal), and also ask for payment_status

image

Fifth Step:

Set a “Make change to User” if you want to classify them as “Active” or “Inactive”
For Active:
PayPal answer is subscr_payment and also subscr_signup (you must write this after Status Subscription is …)
Perhaps you can create only an action for “subscr_signup”, but I’ve created both since I didn’t know exactly what to use. Anyway, it is working fine that way and you can test as many times you want.

image

For Inactive:

PayPal answer is subscr_cancel

image

Sixth Step:

You can set to send an e-mail to your users:

image

Seventh Step:

After that you need to create a button where your customer will click to make a payment and go to PayPal. I used PayPal button creator and pasted the code. You’ll see your button’s id where is marked in blue:

image

After “button id>” add:

<input type="hidden" name="custom" value="Current User’s unique id”>

This is important for you to know which customer is paying you or not. You’ll be able to check all your users’ subscription status that way.

If you have different buttons for subscription and cancelling you should do the same in you Cancel button.

FINALLY

Whenever a customer signs up or cancels a subscription you’ll be able to see their status since you’ve asked Bubble to change users’ status in those situations. You can always check if this workflow is working in the Logs tab.

I hope this can help you!

Good luck!

2 Likes

You should create your own button in your PayPal profile. Try to find “pay using a button” or something like that in PayPal and follow their instructions :wink:

Yes thank you, I found it😉. Thanks for the awesome help!

If only that link took us to where we could find the doc for the plugin rather than a withcopilot.com redirect…

does this only work for subscriptions?