linking parse and stripe user - parse-platform

My app requires users to log in with Parse to make a purchase and uses parse cloud to process payments using Stripe. Payment works fine. I want to associate the card that just used to make the payment to the [PFUser currentUser] so I can load the cards for user to select next time. How can I achieve that? Is it possible to get the card information from the token?
P.S one user can have many card and one card can belong to many user.

I'm not sure exactly what you mean by "card information" but it should be possible to achieve what you want. You'll want to first create a Customer object in Stripe to represent each user. Each Stripe Customer has a list of payment sources associated with them, and you can read the brand and last4 if you need to display a list of these to the user to select one.
Once you create a customer in Stripe, you can create any number of Charges.
All of this can be done in a straightforward manner using the intuitive Stripe API. You can also manage Customers and Charges via the Stripe dashboard.

Related

Laravel Cashier - Prevent duplicated Payment Methods

I'm trying to update the payment method of a subscription. I collect the card information using Stripe's js (using a provided setup intent). Then I send the payment method id, provided by Stripe's js, to Laravel to actually update the User's default payment method.
Now, the problem is I want to prevent the User to insert duplicated cards, and the only way to prevent that would be to retrieve all the user current payment methods ($user->paymentMethods();), and check if any of those has the same fingerprint of the one I'm adding as default.
To get the fingerprint of the new payment method I'd need to get the Stripe PaymentMethod object for the id provided by the Stripe's js. The Cashier method to do that would be $user->findPaymentMethod(id).
The problem is that the payment id is not yet added to the User payments methods, so $user->findPaymentMethod($request->payment_method); fails because that payment method does not belong to $user.
The only solution I can think of would be to first add the new payment method, then check for duplicates and remove them ?
It seems like you’ve already found the best approach of adding the method to the user and then looking to see if there are any duplicated fingerprints, even if it is a little inconvenient.
Reviewing the Cashier documentation doesn’t show any obvious way to access the PaymentMethod before it’s attached to the user. It may be worth reaching out to the Laravel devs to see if there is functionality that would make this flow easier to accomplish.

Braintree hosted fields integration - edit existing card data

I'm using Braintree hosted fields to allow credit card payments, and users can use multiple cards.
How can I allow users to edit existing cards? For example, when a card is renewed by the bank, it keeps the same card number, but the expiration date and CVV change. I want users to be able to edit the expiration date and CVV to keep the card active. Is this possible, or does the user have to enter in a new card from scratch with the same card number?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support
Once your customer has their payment method stored in a Vault record you can use their associated payment method token to run a PaymentMethod.update() call. Using the payment method update you can change most attributes of the stored method, and you can find a full list of those attributes here. When updating actual card information, such as CC number, expiration date, etc. it is recommended that you generate a nonce with the new information rather than entering it manually, but either will work just fine.

Omnipay-Stripe storing creditcard details from form to database

I'm using Omnipay-stripe in laravel 5.2 and is working fine. I want to store credit card details of customers to pre-populate stripe popup with creditcard details while making another payment.
You need to register the card against stripe using createCard which will get you back a card reference. You can then use that instead of the actual card data when making a purchase.
You should be calling create customer as well. Check the documentation in the class docblocks

Stripe: How to transfer amount to customer

I am using Stripe SDK with PHP Laravel 5.1. I am receiving payment from registered user of certain type. Upon certain steps I'd like to transfer a certain amount of their payment to other users who already added their cards in Stripe. How can I do that?
Right now I m only asking his Credit Card Info and storing in Card object. Should I need to ask his bank account information as well?

Google Checkout subscription: How to identify the user

We are using Google Checkout - google handled subscriptions. In our html form we are using merchant-item-id parameter to store the subscription plan id and user id, so when Google Checkout send us back the notification for the new orders (merchant-item-id is there) we know what user for what plan to charge. So far this works perfect.
But now, when a month is passed, and Google Checkout start creating the reoccurring orders, there is no merchant-item-id parameter in the notifications they send. So we don't know what user for what plan is charged.
What should we use as user identifier, so we can handle properly the subscription on our site?
Any ideas?
Btw. I know about the "buyer-id" parameter which is send with each new order notification, but that will not work for us, because it is possible that the same google buyer is paying for several of our users accounts.
I would try putting some unique info in "shopping-cart.items.item-1.merchant-private-item-data" to something unique that I can identify the subscription by.
Nikolaj

Resources