Save card details while doing stripe payment - php

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.

Related

Braintree PHP How To Get Nonce Without DropIn for Vaulting

For our use case, we have an existing form that captures the customer's credit card information. To smooth out the transition from one payment processor to the next since we're not sure when that will happen, we would like to vault the payment method in Braintree without charging the card but keep our existing form.
I see how to vault the nonce that we receive from the Drop-In UI, and I was able to find an answer on SO that described how to pass the payment information directly to Braintree and charging it, however, I have had no luck in finding a way to just pass the card information to braintree for the purposes of vaulting the payment method (with or without the intermediate step of receiving a nonce).
EDIT:
I've discovered the $gateway->customer()->create() and $gateway->creditCard()->create() functions, however, of the various 'unique identifiers' returned from the credit card create call, none of them appear to be vaultable.
It was buried a bit in the documentation, but I was able to do this with an intermediate step:
create customer $gateway->customer()->create(...)
create credit card $gateway->creditCard()->create(...)
take the token from the previous call and pass it to $gateway->paymentMethodNonce()->create(..)
then take the customer id and the newly created nonce and passed them to $gateway->paymentMethod()->create(...)
the necessary vault token was stored in the results object $result->paymentMethod->graphQLId

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.

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

PayPal Billing Agreement with further non regular Reference Transactions

I am implementing PayPal payment to my application.
I am using Laravel Framework and merchant-sdk-php package to handle NVP/SOAP API. I would accually prefer REST API, but i need customers to make Reference Transactions with various amount, in non regular time periods and as far as i know it's possible only with NVP/SOAP API.
The payment flow in shortcut:
1. Payer clicks "connect" button, which is to create billing agreement using "SetExpressCheckout" method. Amount is set to 0 and adding a Billing Agreement field to request. Customer is redirected to PayPal, log in to his account, agreeing to direct debit and finally redirected to my return url.
2. After response is come, return action is fired (the one, which is passed in returnurl field). Next using token from paypal resposne i use CreateBillingAgreement method to get "BillingAgreementID" which i store in database.
3. Using "BillingAgreementID" i make "DoReferenceTransaction" request. No prompt to login is occurring, everything is happening behind the scene. Finally i get response after transaction.
The thinks i want to know are:
1. Is there a way, to get an email address, which consumer used to log in when creating billing agreemenet? I want to show in application which PayPal account (related to mentioned email) is direct debit set to?
2. I want to make some action in databse both after "BillingAgreementID" and "DoReferenceTransaction". Is the response status "Success" and additionally in "DoReferenceTransaction" field "PaymentStatus" set to "Completed" enought to conclude, that transaction is fully completed, and i cant i.e. share some digital goods or should i wait for IPN from this request?
Thanks for all contributions!
Found solution to question 1.
After betting billing agreement id i had to make "GetBillingAgreementCustomerDetails" action. In response i got customer details including email.
Still watching for hint to second question

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.

Categories