How do I set up a PayPal checkout - javascript

I'm wanting to set up a PayPal checkout button so my customers can buy goods using PayPal.
I want a solution that relies on the server and it just the client side.
I have been to the PayPal website and I have found all kinds of methods to enable the setting up of the API but I don't know which one to choose and the site does not explain much so I'm hopping you could tell me which method I should use to set it up?
Thanks

If you need a Checkout button, one of these demo patterns should get you started
Option #1: No server-side code needed.
Option #2: Requires server-side code for payment setup and capture.

Related

Stripe integration - Payment Intent with checkout redirection

I am working on to upgrade the checkout process to make it SCA complaint. As per their doc I need to use the PaymentIntents for it.
And I did follow the steps mentioned in their document: https://stripe.com/docs/payments/payment-intents/web
Now I was able to configure it properly but in this document it mentioned to have stripe-card-element. But I need to use the checkout redirection process instead of this card element.
Need to use this :
https://stripe.com/docs/payments/checkout/migration
If somebody know please share some info.
FYI, I already reached their customer support but they are taking way too long to respond and I am in hurry.
If you are using updated Stripe Checkout (that does the redirect for you), you do not need to create PaymentIntents manually. Checkout uses PaymentIntents under the hood and will automatically do that for you.
It looks like what you want is the client-server Checkout integration: https://stripe.com/docs/payments/checkout/one-time#client-server
i.e. create a Checkout Session server-side, then use Stripe.js and redirectToCheckout to redirect to the Checkout page using the session ID.
There is also a client-only integration that you could leverage: https://stripe.com/docs/payments/checkout/one-time#client-only

Secure Redirect URLS + Survey Monkey

I am using survey monkey to allow users to ask users several questions. If they answer the form, they get upgraded to "premium" and are redirected back to the site. There is no code that survey monkey returns that allows me to know that the user actually submitted the form and is not accessing the redirect URL directly. How can I get around this security wise? I want to make sure the user actually submitted the form to qualify for premium. I'm using node.js on the server side and javascript on the client side.
It's not the prettiest solution, but a quick way I noticed that could be possible from the help center is to disqualify respondents. This is because you can set a custom URL to send the user to after you disqualify them which I don't know if you can otherwise.
You can use advanced branching logic to specify when to disqualify the respondent (example, when the last question is answered). You can also use webhooks through the API to get notifications on respondent completions and you can make changes on your end (such as upgrading their plan) using that.
That's one suggestion, you may want to investigate the help center if that doesn't work for you.

php + js checkout and thank you page

i am build a stripe checkout for my ecommerce on my current project.
everything working good, but i have few question which is confuse me.
is good idea to use ajax for checkout?
i am using stripe.js to checkout, when customer click on checkout button, which will get the token from strips, and then i use ajax to submit the token to php, php will charge the customer, and do the rest of job. is this safe? do i have to use all php code on page to checkout?
i am also using localstorage to store the shipping cart information, is localstorage safe than cookie? if not, is cookie enough for shopping cart information?
about thank you page.
i already create a thank you page, but this page every user can go to this page, like customer didn't buy anything still can go this page. www.example.com/checkout/thankyou.php
for stander checkout thank you page, should i create something to prevent non checkout user to view this page? or i just make thank you page and checkout into one page? like when customer click checkout button, ajax return 1, then popout a modal, show order number, and redirect to other page in 5 sec.
Yes, this is safe, since the Stripe's token is a reference to their system and cannot be used or read by anyone else but your PHP script, using the private API key.
This token is created to ensure no credit card info ends on an unprotected server.
But as they say in their tutorial, you should enable HTTPS to protect the other transaction values of your customer.
They have a real effective tech support that you can reach on https://webchat.freenode.net/ using the #stripe channel.
And about the thank you page... You could use a $_session variable to prevent the access from users who didn't succeded a charge.

Setting up a payment database (payment listener) with PayPal

I just need people to pay me on my site and I need to have statistics with the payments. I was searching for such a long time but I just couldn't find a proper code to do it.
Is there a way to just log every payment as it is made and store it, applying statistics to it later when i want to?
Thanks very much, last time i asked i was pretty much ignored
What you need is Paypal Instant Payment Notification (IPN):
See: https://developer.paypal.com/docs/classic/products/instant-payment-notification/
PHP Example: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
You can enable IPN feature in PayPal account, then insert each payment into database.
Refer to
http://www.rahulsingla.com/blog/2011/11/drupal-handling-paypal-ipn-callbacks-and-saving-data-to-the-database
https://canvascode.wordpress.com/2014/07/22/how-to-set-up-paypal-integration-with-php-mysql/

How to submit a form internally?

I am curious about submitting a form data internally.
Here is an example.
I want to register an account for a website. The website will give a form to register which upon submitting will create an account for me.
But I don't want to go to that site. Instead I'll give a form in my style and collect the same information. Upon submit, I want to create the account automatically. Automatically in the sense, I'll submit the form internally.
The reason why I need this feature is, I don't want my users to create a separate account in another website also. I mean it should save user's time in creating account only. Rest of the things will be taken care by me.
Please let me know if anyone had tried this and had success.
I know it is very difficult for existing accounts and some internal errors. But I also need to track them.
Please let know if this is possible or not.
An Example
There is site called othersite.com which has a form for creating / registering users.
I will a similar form to the user on mysite.com. But upon submit the form information is sent to both mysite.com and othersite.com. Both sites create accounts parallelly with a single form submission.
Unless you are working with AJAX requests and CORS enabled sites, which I assume is not the case, client side technologies ( browser/javascript ) will not help you much to do that.
You have to ask yourself what are the options to integrate with the second site in order to automatically create the account. Following some common patterns used these days:
REST API: You have an url where you can use HTTP to talk to and ask to create the account. Many social networks and other popular services usually expose it. Facebook API
Database: Although it is less recommended you could just insert a new record into the account table if you own and have access to the database used by the second site.
Client Libraries: Some sites provide client libraries so that you can use them together with your project code base. Eg: Twitter Libraries

Categories

Resources