How to validate a customer token in Braintree-Google Pay integration? - php

Our implementation is as follows:
Authorize a credit card associated with Google Pay. Get the nonce.
Using the nonce received, create a Customer account. Save the token for future reference.
Complete transaction using saved token.
The question is how to validate the token before starting a new transaction. Token verification is important because, transaction happens after a few days from customer creation.
Tried Braintree\CreditCard::find($token). This worked for customer accounts created with a credit card. Since we are using a nonce from Google Pay instead of Credit card, it will return a message of:
credit card with token $token not found
How to validate a token in above case?

PaymentMethod::find() will resolve the problem
Reference
https://developers.braintreepayments.com/reference/request/payment-method/find/php

Related

Stripe payment gateway implementation

I want to validate the stripe payment gateway token id before charging customer using that token id.
Can we do this in stripe payment gateway?
Development language could be any for validating token id
There is one way to validate token, that is to retrieve token details
Check here https://stripe.com/docs/api#retrieve_token
\Stripe\Stripe::setApiKey("sk_test_*******lfQ2");
\Stripe\Token::retrieve("tok_******gxZwU");
It will throws an error if invalid token_id is passed
Hope this is helpful.
There is no API to validate a card token. Tokens are short-time lived and should be used right after it's created.
You have to use the token to ensure that the card is valid. When you create a customer via the API and pass the token as source: "tok_XXXX", Stripe will run a $0/$1 authorization on the card with the bank to make sure it's valid. Otherwise you call the Create Charge API to try and charge the card and the bank either accepts the charge or they decline it.

Braintree Transaction

How can we process a transaction in Braintree using the credit card details (multiple card details are stored) in the Braintree? Will Braintree create a cardId for each credit card info?
I work at Braintree. If you have any further questions, feel free to contact support.
Each payment method added to the Braintree vault must have a unique token value, that can either be provided as a parameter to the relevant API call that creates the payment method, or automatically generated if such a value is not provided:
https://developers.braintreepayments.com/reference/request/payment-method/create/#token

Save card details while doing stripe payment

Hi i have been using stripe for the first time in my project where i ask user to provide their Credit card details for payment & i generate stripe token and charge the customer. I have provided a checkbox where customer can save the card details for future transactions & the requirement by the client is that if checkbox is checked, the details have to be saved once the payment successfully done. I am only getting the stripeToken in the processing via POST method and not the card details. Is it possible to get the card details back from the stripeToken in programming way or what can be an equivalent & convenient option to do it?
I tried adding the name attribute to the fields required by stripe for the token generation but in the form POST it is coming empty.
Stripe Only provides the Last 4 Digits of the card .
You can save the CustomerId provided by the Stripe API that can be used later for payments,
When the checkbox is checked you can use the token to create a new customer (or update if it already exist ).
Into the link of #vher2 you can find an example to follow.
EDIT:
Inside the token generated from Stripe.js do you have all the information you need. See the Example Response into Api Stripe of token creation.

Stripe api one customer with multiple card using php

I'm using the stripe api with php, and the basic process is as follows:
Submitted with the payment form and a stripe token is created via php stripe sdk.
If the customer exists in the local database, I grab their customer_id and fingerprint. Otherwise a new customer is created using the token as the source/card.
If the customer and same fingerprint exists in the local database, if the token object response fingerprint and my local database fingerprint different means.
I retrieve the customer details using existing customer id and I create a new card using customer source create api($customer->sources->create(array("source" => "tok_18hAe4DdoStEhOoYr2TTQlaL")); ).
Card creation time: how can I validate cvc, expmonth and year?
Yes, you can create multiple cards with a single customer in Stripe.
To validate the basic card details you can use Stripe.js library. It by default check for CVC, expiry date, and card details. A user is not allowed to enter wrong details.
If you are creating token directly from backend code then still Stripe verify the details and not return's the token in case of wrong details.
Backend and js also checking cvc length only .
Example: If i put my real card details and cvc for 123 means stripe returning the token object.

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