How to validate card before billing - php

I am using stripe in PHP. I have a customer and a card added to the customer in stripe. The added card is the default card for the customer. Is there a way to validate the card with the card id of the default card of the customer before billing the card?

When you create a customer in Stripe from a card token we automatically run a $0/$1 authorization on the card to make sure it's valid. This means that is the customer create succeeds then the card is valid.
That doesn't guarantee that you will be able to charge the card though as the banks ultimately decide whether or not they want to let a charge go through and this can depend on a lot of factors. The only way to make sure that a charge can go through is to create the charge itself and see whether it succeeds or not.

Related

Recurring billing in Authorize.Net

I am using the below feature to create recurring ARB at Authorize.Net
https://developer.authorize.net/api/reference/index.html#recurring-billing-create-a-subscription
We have implemented it in PHP but it is also accepting the test credit card details at time of ARB creation in live mode. It is not validating the credit card at time of ARB creation.
So is there anyway to validate the card at time of ARB creation not at time of amount deduction. I know it will validate when the first amount will deduct but I want validation at time of ARB creation.
Please suggest some solution if someone faced it before or anyone have any idea how to do it.
You can validate the card at the time of subscription payment by doing a $0.00 or $0.01 AUTH_ONLY transaction before you create the subscription. If the card is approved you can be sure the card is valid.
Keep in this mind that this does not validate that the card will be valid at the time the first subscription payment is processed or that the funds will be available (i.e. the transaction will be approved) as there is no way to know this until the card is actually processed at that time. But this will validate the credit card is otherwise valid.
Assuming you want to charge the credit card immediately and then have a recurring payment afterwards, you should do an AUTH_CAPTURE for the first payment and then future payments should be done using the ARB API. That way you are sure to capture your first payment, and validate the card, before you create the subscription.

Associate one-off Stripe payment token (tok_) with Customer object

Is it possible to associate a one-off Stripe charge/payment with a Stripe Customer profile but not save the card to the profile? I'd really like to organize my Customers and their purchases within the Stripe dashboard, but I can't see any way to do this. From what I can tell there are three ways to create a payment:
Using the source parameter and no customer parameter. The source parameter in this instance starts with tok_
Using the customer parameter, which will use the default card on file.
Using the customer and source parameters, where source is the card ID associated with the customer starting with card_.
I've looked through the docs and can't see anything that alludes to being able to create a payment using customer and a tok_ source. Am I missing something here?
This is not supported by Stripe at the moment. You can still do this though with a few steps:
You create a card token
You add the card to a customer
You charge that card
You delete the card from the customer
This ensures that you don't save the card but still have the charge associated with the right customer.

Two different Payment Gateway for one payment

I'm building functionality in which product payment is divided into two parts -
1. service charge
2. actual payment
service charge payment will be done thr' stripe api (as client wants this gateway)
actual payment will be done thr' any type of gateway as per user selection.
But, crucial part is, both parts of payment should be done on one click.
On one click, it should go to stripe and other gateway that user has selected.
Can it be possible?
If yes, what will happen in the case where one of the two parts of payments is successful and other one failes.
Where can I redirect success url for both types of payments? on same page or another page?
As card details will be given only once by user in one form and submitted, can these details remain secure while processing of two transactions?
I have thoroughly searched for this, but can't find answer.
Thanks in advance.
Assuming this is a credit card payment only (and not a wallet such as PayPal or WebMoney, etc) all you need to do is store the credit-card details at your servers. Just make sure you are PCI compliant for that.
In this case, you will charge the service fee via stripe and the actual payment via the 2nd payment gateway. Just make sure you refund one if the other failed. Also ensure that the user is well aware that he will see TWO charges on his card. I would advise showing that nicely in the invoice page.
So it's not that complex of a flow for stored credit cards, but if you lack the credit card data and let the user pick an online payment option such as PayPal, then you'll need to ensure this online payment is successfully completed before charging the service fee via stripe.

Subscription system with Paypal

I'm developing a restaurant catalog in which the restaurant owners pay a monthly fee for having their restaurant appear on the site. I was thinking in using Paypal recurring payments but I don't understand exactly how it works. Would Paypal automatically charge the fee each month? (Like auto-renew) or would the users be able to decide if they pay or not? I need that the users decide if they want to continue with the membership instead of being automatically charged. How can I achieve this with Paypal?
I'm using express checkout with instant payment notifications (IPN).
Recurring Payments would be a subscription that would be charged automatically unless the profile was in a canceled or suspended state. So if your customers signed up, they can indeed choose whether to pay or not if you give them a way to suspend their profile, which you can do via the ManageRecurringPaymentsProfileStatus API.
If you would rather setup a way where users have to click a button to approve the payment each month then you could go with a billing agreement and a reference transaction. In your SetExpressCheckout request you would make sure to include the billing agreement parameters to get a valid token, and then when the order is completed with that billing agreement you can use the transaction ID you get back from it in a DoReferenceTransaction request in the future to process any amount using the previous billing info that PayPal has saved, so no additional login auth would be necessary.

Paypal credit card validation

I want to check that the credit card number provided by customer to my site is valid or not for further transaction. for that i wand to only verify taht the CC no is valid or not by Paypal.
A method for that can be with paypal api
step 1: DoDirectPayment with PAYMENTACTION=Authorization for amt of $1, then
step 2: DoVoid that request
Does any one can tell me
is any amount is charged by paypal for doing tis stuff?
or any other better way you know?
My site is in PHP..
PayPal charges when a transaction is made, not an authorization. If PayPal charged for authorizations then you would have to pay for people who entered their credit card, authorized, but then abandoned the purchase.
This question should be asked at https://www.x.com/docs/DOC-1613
If you are concerned about whether or not the credit card is valid, you can always check it before posting the transaction to PayPal. I have written a CakePHP component for doing just that. This component could very easily be switched to a class and used for credit card validation:
http://github.com/cdburgess/components/blob/master/billing_validation.php
It is very thorough in checking:
what type of card it is (visa, master
card, etc.)
if the card is in fact valid (using
the luhn algorithm)
The advantage of validating the card in your system prior to posting to PayPal is there is no round trip cost. Meaning, you do not have to send a request to the PayPal API to do the validation. Chances are they will do the same validation my billing validation does anyway. It can be done faster right on your server.
Keep in mind, the one thing this class will not catch is credit card fraud. That will require a service. However, typically if there is something funny about the card, paypal will catch it when you are trying to process the funds on purchase.
Happy Coding!
I made it with the help of PAYPAL API's DoVoid Function. I'm making a payment of $1 in Authentication Mode, and if it return success i'm using DoVoid with returned transaction-id.

Categories