User is not redirected to their respective bank account page while doing transaction on Razorpay? - e-commerce

We are using razorpay as a payment gateway for handling the online payments on our website.
The problem is that some of our customers are not able to complete their transactions as when they select a payment mode (net banking or card payment) they are redirected to a blank window (with URL about:blank)
Ideally, they should be redirected to their respective bank accounts login.
For some customers, everything is working fine and they are able to do their transactions so we do not thing the problem is with integration.
User experience for the user:
User selects online payment
A dialog is popped up handled by Razorpay.
User selects a payment mode.
User clicks on the Pay button
User should be redirected to their bank accounts login.
User logs in and does a transaction
From step 2-5 is handled by razorpay.
I tried contacting their support team but they are not able to figure out the reason for the issue along with any solution.
Please share if anyone has experienced a similar issue and what was the solution for it.
I am considering that there might be some issue on the clients browser(some pop-up blocker or something)
Thank you for your help.
var _this$state2 = _this.state,
shipping = _this$state2.shipping,
billing = _this$state2.billing;
var options = {
key: _env.default.rzpKey,
amount: _this.total * 100,
// 2000 paise = INR 20, amount in paisa
// currency: 'USD',
name: _env.default.siteTitle,
description: 'Your Order',
image: '/static/logo-accent.png',
/* Below Hnadler is called when the transaction is successful */
handler: function handler(response) {
/* Create Order is called when the transaction is successful*/
_this.createOrder(response, _this.state.cod);
},
prefill: {
name: billing.firstName || shipping.firstName,
email: billing.email || shipping.email,
contact: billing.phone || shipping.phone
},
theme: {
color: '#000'
}
};
var rzp = new Razorpay(options); // eslint-disable-line
// Razorpay dialog is opened
rzp.open();

Related

Does Stripe still allow pre-filling for express accounts? If yes, what is syntax to pass things like email, first name, business name etc

image of initial landing screen where i also want mobile phone pre-filled
Have been following some online tutorials on creating a Stripe Marketplace, have it all configured however I'm having trouble passing details i have collected on a user, ie email as best example, and then having that be pre-filled when a new vendor on my marketplace goes through the Stripe Connect Express onboarding process.
Any help would be great, particularly on how to pass these details in the accountLink that is being sent.
export const makeSeller = async (req, res) => {
try {
// 1. find user from db
const seller = await Seller.findById(req.user._id).exec();
// 2. if user dont have stripe_account_id yet, then create new
if (!seller.stripe_account_id) {
const account = await stripe.accounts.create({ type: 'express' });
// console.log('ACCOUNT => ', account.id)
seller.stripe_account_id = account.id;
seller.save();
}
// 3. create account link based on account id (for frontend to complete onboarding)
let accountLink = await stripe.accountLinks.create({
account: seller.stripe_account_id,
refresh_url: process.env.STRIPE_REDIRECT_URL,
return_url: process.env.STRIPE_REDIRECT_URL,
type: 'account_onboarding',
});
console.log('ACCOUNT LINK', accountLink);
// 4. pre-fill any info such as email (optional), then send url resposne to frontend
accountLink = Object.assign(accountLink, {
'stripe_user[email]': seller.email,
});
// 5. then send the account link as response to fronend
res.send(`${accountLink.url}?${queryString.stringify(accountLink)}`);
} catch (err) {
console.log('MAKE SELLER ERR ', err);
}
};
Stripe allows any of the fields on an Account object to be prefilled! The place to prefill this info is in the stripe.accounts.create call before creating the AccountLinks object, if you prefill the information in the Account object, it will not be collected in the onboarding flow[1].
const account = await stripe.accounts.create({ type: 'express', email: 'vendor#example.com' });
Check out the API doc section on creating an Account object for info on how to populate specific fields[2].
[1] https://stripe.com/docs/connect/express-accounts#create-account
[2] https://stripe.com/docs/api/accounts/create

React Native Paypal Payment Gateway using react-native-paypal-lib

I have spent more then 6 hours in integrating paypal in React Native. I am using react-native-paypal-lib library.
Code:
RNPaypal.paymentRequest({
clientId: 'MY ID I KNOW',
environment: RNPaypal.ENVIRONMENT.SANDBOX,
intent: RNPaypal.INTENT.SALE,
price: 60,
currency: 'USD',
description: 'Android testing',
acceptCreditCards: true
}).then(response => {
console.log(response)
}).catch(err => {
console.log(err.message)
})
Response:
{response_type: "payment", response: {…}, client: {…}}
client:
environment: "mock"
paypal_sdk_version: "2.15.3"
platform: "Android"
product_name: "PayPal-Android-SDK"
response:
create_time: "2014-07-18T18:46:55Z"
id: "PAY-18X32451H0459092JKO7KFUI"
intent: "sale"
state: "approved"
response_type: "payment"
I am getting the response too. But, I cannot see the transactions in my sandbox account. Also, I am getting the same response id every time.
An approved v1/payment (or v2/order) does not create a transaction. The customer has merely passed through the PayPal.com portion of the process, to give their approval.
After your app is notified of this approval, by e.g. their return from PayPal.com to your app with the details, you must execute the v1/payment (or capture the v2/order), which will create a PayPal transaction. The transaction will have its own new unique ID, which is what you should store for accounting purposes.
(The ID used during the approval process, PAY-##### with v1/payments, or just 17 characters for v2/orders, is only worth keeping around about ~1 month for debug purposes. It has no business/accounting value.)

Stripe integration with 3D Secure

I have an Express app that I had successfully tested with tokenisation of payments. As I'm in the UK and will be accepting mainly UK cards, I believe I need to implement 3D Secure handling. I'm really struggling to understand the official documentation - examples are few and far between in my opinion. From the following: https://stripe.com/docs/sources/three-d-secure
I have got Sources working instead of Card payments using tokens. This is step 1. Step 2 requires that I determine if the card supports 3D Secure. I have been doing this client side but am not sure how to handle this subsequently - I have been attempting to send the user for a card payment if 3D Secure is not required. BUT if it is required, do i need to create another Source? And do I do this server or client side? I also cannot get the return_url field to do anything - 3D Secure cards simply fail.
Are there any examples out there that would help me? I am finding the official docs simply tell you roughly what to do with not much in the way of 'how' to do things.
I should add I am using v3 with Elements, NOT Checkout.
Thanks for any help.
edit: the below server-side doesn't seem to do anything:
stripe.sources.create({
amount: 6500,
currency: 'gbp',
type: "three_d_secure",
three_d_secure: {
card: stripeSource,
},
redirect: {
return_url: "http://example.com"
}
})
The documentation states "To allow your customer to verify their identity using 3D Secure, redirect them to the URL provided within theredirect[url] attribute of the Source object."
My source object doesn't contain this field?
edit: This is what I have now. The redirect works, but as soon as I authorize the payment, the card declines:
stripe.customers.create({
email: cust_email,
source: stripeSource
}).then(function(customer){
return stripe.charges.create({
amount: fee,
description: "Client Ref: " + clientref,
currency: "gbp",
customer: customer.id,
metadata: {
'allocation:': allocate
},
receipt_email: cust_email,
source: request.query.source,
})
}
).catch(err => {
console.log(err)
})
stripe.sources.create({
amount: fee,
currency: 'gbp',
type: "three_d_secure",
three_d_secure: {
card: stripeSource,
},
redirect: {
return_url: "http://localhost:8000/charge"
}
}).then(function(test) {
response.redirect(test.redirect.url)
})

How to create a custom user authentication in Meteor?

I am trying to create the following authentication for an app:
User enters phone number and receives an SMS with a code generated in the server (the SMS is handled through an external service). If the user enters the right code he is logged in.
This means I must have two login stages: registering user with a phone and logging him in with the code, so this is what I think the client should look like:
Meteor.getSmsCode = function(phone, username, callback) {
Accounts.callLoginMethod({
methodName: 'getsmscode',
methodArguments: [{
getsmscode: true,
phone: phone,
username: username
}],
userCallback: callback
});
};
Meteor.loginWithCode = function(phone, code, callback) {
Accounts.callLoginMethod({
methodName: 'login',
methodArguments: [{
hascode: true,
phone: phone,
code: code
}],
userCallback: callback
});
};
But I am confused about the server side - there should be two methods:
the first should only register a user (and communicate with the SMS service) and second should log him in.
This is the server test code for now:
Meteor.users.insert({phone: '123456789', code: '123', username:'ilyo'});
Accounts.registerLoginHandler(function(loginRequest) {
var user = Meteor.users.findOne({phone: loginRequest.phone});
if(user.code !== loginRequest.code) {
return null;
}
var stampedToken = Accounts._generateStampedLoginToken();
var hashStampedToken = Accounts._hashStampedToken(stampedToken);
Meteor.users.update(userId,
{$push: {'services.resume.loginTokens': hashStampedToken}}
);
return {
id: user._id,
token: stampedToken.token
};
});
And this is what happens when I try it:
Why an I getting the 500?
Why doesn't the user have a code and phone fields?
What method should I use for the getSmsCode?
Meteor.createUser is described on How can I create users server side in Meteor?
Then, the Accounts.onCreateUser would contain business logic http://docs.meteor.com/#accounts_oncreateuser
A more exact message for the 500 would be on the server-side stdout. Probably security.
Your Login Handler must return an object as follows:
{ userId: user._id }
Sorry I don't elaborate in the whole problem, I don't agree on your full approach but looks you are in the right path to get the feature you need.
Also, this question is one year old, now there are a few packages at atmosphere that address this kind of authentication =)

Google Auth2.0 log out

I'm currently trying to make a site where the user can log in with his google+ account. Most of it is working. I get them to grant access to my website. They can log in and I get their name and user ID, and I show content specific to their google account on my site.
When however someone else wants to log in and I try to 'log out' of the site, the google log in still remembers that it just logged in and after logging out it instantly runs the code to log in again. If I delete the SSID cookie from google it doesn't do this, so I'm assuming that's where google stores the fact that I just logged in with x.
Is there a way to when I log out make google not instantly log in with the same account, but rather ask for the e-mail and password of a google user?
I feel like I'm missing something obvious here, but I can't figure out how to deal with this.
Code I use to Auth and get data:
<button class ="btn btn-primary" id="authorize-button" style="visibility: hidden">Log in</button>
<script>
var clientId = '';
var apiKey = '';
var scopes = '';
function handleClientLoad() {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth,1);
}
function checkAuth() {
//alert("authorize");
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
}
function handleAuthResult(authResult) {
//alert("authorized");
//alert(authResult.access_token);
var authorizeButton = document.getElementById('authorize-button');
if (authResult && !authResult.error) {
authorizeButton.style.visibility = 'hidden';
makeApiCall();
} else {
authorizeButton.style.visibility = '';
authorizeButton.onclick = handleAuthClick;
}
var token = document.createElement('h4');
token.appendChild(document.createTextNode(authResult.access_token));
document.getElementById('content').appendChild(token);
}
function handleAuthClick(event) {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
return false;
}
var x;
function makeApiCall() {
//return;
gapi.client.load('plus', 'v1', function() {
var request = gapi.client.plus.people.get({
'userId': 'me'
});
request.execute(function(resp) {
x = resp.id;
var heading2 = document.createElement('h4');
var heading3 = document.createElement('h4');
heading3.appendChild(document.createTextNode(resp.displayName));
heading2.appendChild(document.createTextNode(resp.id));
document.getElementById('content2').appendChild(heading2);
document.getElementById('content3').appendChild(heading3);
$.post("token.php", {id: x});
});
});
}
When you make the auth call, set approvalprompt to force. This will force the consent dialog to appear every time. It overrides the default setting of "auto." You can learn more at https://developers.google.com/+/web/signin/#sign-in_button_attributes.
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true, approvalprompt: force}
After the user authorizes your app, they are basically logged in to your app any time that they are also logged in to Google, especially when immediate mode is turned on.
What some sites do is have a logout link or button that displays a page or dialog that says something along the lines of "You're logged in to Google and this site with account blah#blah.com. If you want to switch accounts, go to google.com and log out of your Google session."
You can also track the logged in status of a user using your own cookies and setting and removing them during the appropriate events in your code. You would want to discard any tokens that your app obtained on behalf of the user during a log out event. When the user logged in again, they would not need to re-authorize your application with the popup (or redirect window), but you'd still get a new access token during the callback.