I want to update existing paypalAccount of a Vault user every time she makes a purchase using paypal checkout.
According to the documentation, I can only update creditCards using paymentMethodNonce.
Another piece of documentation shows how to update Paypal account using token. My understanding is that token is only available only after paymentMethod is added to Vault.
But all I know at this point (before I update the Vault) is paymentMethodNonce from the client-side. And I don't want to create a new paymentMethod/paypalAccount but to update the existing one.
Is there any way that I can update existing paypalAccount using paymentMethodNonce?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
Currently there is not a way to update a paypalAccount using a paymentMethodNonce.
You can update a paypalAccount by updating the paymentMethod tied to the paypalAccount. First, save a mapping from user to a payment_method_token on your server. The payment_method_token will be returned from paymentMethod.create. Then, anytime you want to update a user's details, you can retrieve the paymentMethod using the token, and call paymentMethod.update.
For more information on updating paypalAccounts, please check out this documentation.
Related
I apologize in advance for this question, as its probably rather silly, but I really can not find any answers elsewhere.
My current goal is to integrate a subscription to my website, that allows for a user to have access to certain parts of the site.
I've watched a few videos on it, but it leaves me open ended with some questions.
PayPal allows you to manually create a subscription plan at https://www.paypal.com/billing/plans. When you create a plan here, it gives you the code you need to get the pay pal sub buttons to display on the page. Users can then use them to create the subscription. This is great. However, I have found now way to validate the results of the transaction. My goal would be that if the user was successful, I would be able to retrieve data via the API, that says it was successful, and I could then store than information in my database, and grant them access. Does anyone know how to get the data from the manually created facebook plans?
I did watch a video that had you do everything from your website (you create it all within your own code), the end result however sent everything through $_GET variables in the url. I feel like having this data exposed could result in the manipulation of the subscription, and grant it to users who were unsuccessful in creating a subscription.
I have no problem doing all of the coding to make this work, but I really want to make sure I do it the best possible way.
There is a few way to do it. By setting up a webhook and listen to paypal success notification and react to it. By using the Paypal Subscription API. Or a combination of both.
As you are using the paypal button you will have the onApprove function which will trigger upon user confirming the subscription. You can query the subscription data with:
onApprove={async (data: any, actions: any) => {
const detailedSubscriptionData = await actions.subscription.get()
// activate subscription on your side by sending it to your backend
...
// etc.
}}
Inside the data you have queried above, there will be a paypal transaction id (I-....) that is unique for each transaction, as well as your product id (plan_id). You can now do the following for verification on your backend:
Check if there is already a subscription (from another customer) on your side with that paypal transaction id
Check for the plan_id
Queried the API Subscription Details with the paypal transaction id and check for status, etc. as well as matching of plan_id
Keep in mind that for using the API you will have to queried for an access-token which in turn required you to have Developer App Setup following these steps.
I'm trying to make an app that sells a service, for which users pay based on the amount of time they've used it for, so I don't have a physical shipping address involved.
I want to be able to allow my users to save and then reference saved cards in future transactions. I know the way Stripe tracks a specific customer is through a customer_id, but I'm not sure how to attach a card to a specific customer_id and then reference it in future.
Also, I'm a little confused on the use of ephemeral_keys. Some Stripe tutorials talk about needing these on the server side, and some don't mention them at all, and that leaves me very confused.
This one talks about ephemeral_keys while creating a paymentIntent: https://stripe.com/docs/mobile/ios/basic#
And this one doesn't: https://stripe.com/docs/payments/integration-builder
Any help would be greatly appreciated! Please let me know if you need any more information from me.
PS: If you could also point me to some of the relevant View Controllers Stripe uses to save new cards and display saved cards, I'd be more than grateful!
The flow on https://stripe.com/docs/mobile/ios/basic includes the Customer for your payment context, which will cause the created PaymentMethod to be attached to that Customer. You can verify this after the initial payment by retrieving the PaymentMethod on your backend with your secret key and checking its customer field [0].
If you have a PaymentMethod and want to attach it to a Customer, you'd use the API on the backend [1].
You can retrieve a list of the Customer's existing PaymentMethods via the API [2] on the backed as well (again, with your secret key). Then you can pass a list of their id's and some identifying feature (last 4 digits, as an example) to your app in order to display and let the customer select the one they want to use. Then you take that PaymentMethod's 'id' and use it to create the new payment.
Ephemeral keys are usually only used with the iOS (or Android) SDK's, so when you're using the backend of your integration (i.e. the part that is running on a server somewhere and not distributed with your app) you generally don't need to worry about them.
[0] https://stripe.com/docs/api/payment_methods/retrieve
[1] https://stripe.com/docs/api/payment_methods/attach
[2] https://stripe.com/docs/api/payment_methods/list
When I do a Paypal API signature request under business profile, the generated api is using my old website ---whateverAPI.my-old-website.com
I've updated all of my business information and see no instances of the old url in my paypal account or the developer or sandbox accounts.
I do not have the old login information for developer area where I created the original API information as it was changed to my new login/business.
I need to change the URL associated with my account so the api generated has the apicode.new-website.com
I know this is a low level expertise for most of you compared to what you are coding but I am completely stuck and have tried everything I can think of.
Thanks for taking the time to read!
When the API is first requested on an account, it is generated based on the email address associated with the account at the time. Even if you remove the email address and request new API credentials, it will still use that original email address. There is no need for concern, you only set this in your API call or in your shopping cart to use. Buyers are not going to see it or anything, and it's not something you would regularly share or have to use all that often. Once you set it in your code, you don't really mess with it again unless you need to set up the API credentials again.
From the documentation it appears that I can only set the billingDayOfMonth when I create a subscription. but I don't see that option when updating a subscription.
https://developers.braintreepayments.com/reference/request/subscription/create/php
https://developers.braintreepayments.com/reference/request/subscription/update/php
Is there another way of doing this? Or do I have to cancel a subscription and create a new one? I'd prefer not to do that but not sure what my options are
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
Your initial conclusion is correct — once a subscription has been created, the billing date cannot be updated. You will have to create a new subscription, but you can specify a custom subscription ID that links the new one to the canceled one if that helps you keep track of things.
Here's my problem. When I create my transaction with the classic api, I find myself giving them a unique tracking id (https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-payments/Pay_API_Operation/) that match the one I store in my DB.
But after 8 months of devellopement, I have some problem. I reset my DB, so on my end, the tracking id can be used, but on Paypal end, it can't.
So I was wondering if there's any way to delete the transactions I've made so far? That way I could re-use theses tracking ID and make sure that this time I don't delete the one I've used, but instead store them in another collection.
Thanks a lot guys!
What I finally did was to make a simple function that generate another ID if the id was refuse by paypal, and add the refused one in my DB. That way, at some point, I caught up with the paypal transactions ids and was good to go!
What we did was to just create another app in our Paypal developer dashboard.