PayPal pre-approved payment button - javascript

I'm trying to implement the paypal pre-approve functionality (obtained through the Adaptive Payment API) in our crowdfundig platform. At the click of the paypal pay buton button my back-end generates the pre-approve key and SHOULD redirect the user to the appropriate PayPal link:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-preapproval&preapprovalkey=GENERATED_PRE_APPROVE_KEY
I am currently using the classic checkout button (checkout.js) which does not seem configurable to be redirected to another type of PayPal address (it just redirect to the standard payment url and not the pre-approve). What should I do? Create a custom button? Or can I change the behavior of a classic PayPal button?

I will answer to my own question. After the generation of the pre-approval key, what I did was redirecting the user from the current page to a new one to this link :
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-preapproval&preapprovalkey=GENERATED_PRE_APPROVE_KEY
In order to redirect the user to a new window I used the standard :
window.open(linkWithPreApprovalKey);
It seems that ther's no specific pre-approval or adaptive payment button made by PayPal (such as checkout.js for a normal checkout)

Related

Stripe collect payment later workflow Node/Express/EJS

I am working on the payment portion of an app using Stripe and having trouble trying to figure out the best way to route customers. Essentially, the way the app is supposed to work is:
Customer goes to site to enters payment details.
Payment is broken into two parts the Fee and the Deposit.
Customer submits payment details.
If the funds are validated they are brought to a success page.
If the funds are not validated they get an error page.
Later, the funds are captured either with or without the deposit amount.
I have Stripe set up where I am creating the payment intent with capture_method: 'manual' set so I can capture the funds later. I am passing the client secret to the front via EJS, and using stripe.confirmCardPayment() to 'run' the card. All of that seems to be working fine and they are correctly showing up in my Stripe dashboard as uncaptured payments. So, from here what is the best way to route the user to the correct page after the card is 'run'. In other words, if the funds are there then route to success pages, otherwise route to an error page. There needs to be some validation on the server side otherwise the customer could just directly visit the success page route without paying. Thanks for any help and ideas!
stripe.confirmCardPayment returns a Promise that resolves with result.error if there were errors (like the charge declined) or with result.paymentIntent if the PaymentIntent confirmation succeeds: https://stripe.com/docs/js/payment_intents/confirm_card_payment
Once your confirmCardPayment() Promise resolves, you can look at result.paymentIntent.status (which in your case would be requires_capture).
During this, you can make any arbitrary calls to your server (like pass the PaymentIntent/Customer ID and update your database) and then redirect your customer to the success/failure page accordingly.

Sending credential to a login web page

Is there a way to send username and password to a url of a login web page?
For example, if the login web page contains 2 textboxes : user name and password and a login button, is there a way to send to the url the credential in order to go directly to the next page coming after the login?
The url for the login page looks like:
http://[ip address]/jsp/login.xhtml
I tried to send the username and passord as following:
http://[username:password]/[ip address]/jsp/login.xhtml
http://[ip address]/jsp/login.xhtml?[username:password]
If there is a way to do it by sending the command through a batch file?
If it can be done using c# or javascript it is also fine.
The best option is Javascript. It can easily run from a plugin of your browser.
(I'm using 'Custom Javascript for Websites', a chrome plugin: https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija)
Firstly you navigate to the login page and check the source code for the following ID's:
- Username-inputbox
- Password-inputbox
- Submit button
Knowing these things, we can add this to our plugin: (Fill in the id's at the right places)
// First we check if we're on the right page
if (window.location.href == "URL")
{
// Find the ID's of the corresponding inputs
document.getElementById("username").value = "user0";
document.getElementById("password").value = "user0scode";
// Then click the submit button, just as we do
document.getElementById("btnSubmit").click();
}
There is free tool called Fiddler. It monitors/debugs all the traffic on your machine i.e. using browsers or any other medium. You can try capturing the action/request behind the login button using Fiddler, and then mutate the same action/request and you will be able to change the username/password for that action/request.
Download from here, and read this.

push form entries from contact form directly into affiliate signup form (wp-plugin) using js

ok so we have the following situation:
our potential customers make a trial account signup using contact form on our wordpress homepage. now we pretty much want to make every new trial-user, an affiliate at the same time.
there are a bunch of different wp-plugins to managae affiliates.
my q:
is it possible to send the form entries (from the trial signup) directly to the affiliate signup as well (and submit that in the background)?
because then the user would get one conf. mail with his trial account details from our backend & a 2nd email with his affiliate tracking link and some info on how that works.
thanks guys

Creating facebook app with callback url

I am creating a facebook app. And I want to let users to login to my website using it(Using passportjs).
But to do that, I need to give callback url(my website url). But I couldn't find that field in the facebook app creating page.
Am I missing something? I have searched for it for a quite long time.
Writing as of Feb 2, 2014 I found these instructions to be current;
Go to your app
On the left-hand sidebar, click Settings
Under the main section, click Add Platform
Click 'Website'
Specify your callback in the Site URL field (e.g. http://localhost:3000/auth/facebook/callback).
Go to your app.
On the left-hand sidebar, click Settings.
Under the main section, click Add Platform.
Click 'Website'.
Specify your callback in the Site URL field (e.g. http://localhost:3000/auth/facebook/callback).
Call back URL must be provided in the Clint O auth settings in order the facebook to send the user credentials and access Token after user logged into facebook through your app. Facebook's developer website UI was changed again. Now the client OAuth settings block was moved into Facebook Login. To provide the callback URL Now the path is
Your App Dashboard > On the Left-hand sidebar > facebook login > Clint Oauth Settings > Valid OAuth redirect URIs
The "Callback URL" is the URL that will be contacted once the user has accepted or rejected the OAuth request.
This is set as a parameter of your OAuth request. So you set the URL in your own program, not somewhere in Facebook.
In Java/Spring social you would do:
OAuth2Parameters params = new OAuth2Parameters();
params.setRedirectUri("http://yoursite/callback");
Once you set this, it must also match a "Valid OAuth Redirect URL" as sivanagaraju's answer mentions, otherwise Facebook will reject it. In the "Facebook Login" tab under your app, enter all valid callback URL's, such as http://localhost/callback, http://productionUrl/callback, etc.
If you don't see "Facebook Login" tab under your app, click "Add Product-> Facebook Login->Get Started" Enter the Valid Callback Urls -> Save changes.
Go to the Facebook developer page.
In the left hand side bar, under 'Products' you'll either see or need to add the Facebook Login product.
Once you've added it, you can go to Facebook Login settings and add your URL to 'Valid OAuth redirect URIs'

Implementing digital goods express checkout without javascript

Is it possible to implement express checkout for digital goods without having to use javascript? I want my website not to depend on clients having javascript enabled and can live with customers being redirected to PayPal's pages to authorize payment. Can I simply redirect the user to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout &token=APIToken instead of https://www.paypal.com/incontext?token=APIToken after the call to setexpresscheckout if I mark the transaction as a digital goods one (noshipping=1, etc.)?
The answer to your question is: yes.
Don't change anything about your initial API call
Like you mentioned, after you get your API token from paypal redirect the user to: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=APIToken
If you are transitioning from js, remember to remove the paypal script tag and the code that converts your link into a popup:
new PAYPAL.apps.DGFlow({ trigger: "link_id" })

Categories

Resources