For my react app, I am using the Session object to handle purchases in Stripe, and I am using a Customer object if the user is logged in. I tried using Payment Intents, however it only gives me the total balance for each payment and not the actual items and their amounts that were purchased. I want to be able to retrieve the line_items a customer purchased in each payment (they're not Product objects if that helps).
Any help is appreciated!
You should retrieve the Session object, which does contain those.
Related
I'm currently working on a NextJS-Supabase project where I have to build a dashboard for some vendors.
Each vendor should be able to login into his dashboard and add his customers to keep track of their informations. The process of adding a customer falls into the following steps :
fill the customer email and submit the request of adding him.
The customer receives an email containing a link available for 5hours.
The link redirects him to a page where he can complete some of his basic information such as address, phone...etc.
Once the form submitted the customer data are updated in Supabase.
I don't know how to implement this in NextJS-Supabase knowing that the customers don't have a user account. Only vendors have a user account and can login/logout.
I did the Stripe integration, I am using the Stripe Checkout and Stripe customer portal for payments management. I have 2 types of users, Students and Teachers. I want to show them subscription on the Customer portal based to their role. The Stripe is giving us the option for the product that we want to show but I am unable to figure out how to show the products to both the users based on their roles so that the Teacher don't see the Students products and the Students do not see the Teachers products.
If you need multiple Customer Portal configurations, you can do so via the API[1]. You can specify what products and prices are allowed in each configuration by passing them in to the features.subscription_update.products parameter[2] of the billingPortal.configurations.create call.
Then when creating the Customer Portal session, you can pass in the ID for your Student or Teacher configuration to the configuration parameter[3] of the sessions.create function.
[1] https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#configure
[2] https://stripe.com/docs/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products
[3] https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-configuration
For my react app, I am using the Session object to handle purchases in Stripe, and I am using a Customer object if the user is logged in. I'm having trouble figuring if I'm supposed to use the Payment Intent, Charge, or Balance Transaction object to retrieve a customer's payment history (provided the customer id).
Any advice is appreciated!
You would use the List all PaymentIntents API to get a customer's payment history:
https://stripe.com/docs/api/payment_intents/list
https://stripe.com/docs/api/payment_intents/list#list_payment_intents-customer
By default this will return the last 10 payments that the customer made. But, you can increase that number to 100:
https://stripe.com/docs/api/payment_intents/list#list_payment_intents-limit
If you want to list more than the last 100 payments you would need to use the auto-pagination feature provided by Stripe's libraries:
https://stripe.com/docs/api/pagination/auto
Depending on what information you need to display in your app you could also use the List Charges API. But that resource is being phased out in favor of PaymentIntents so I would look to use PaymentIntents first. The Balance Transactions API is mainly useful for displaying changes to a given Stripe account's balance rather than a given customer's payment history (i.e., tracking all payments, transfers, payouts and refunds on the account as a whole).
Short version:
In matomo JS tracking, we only need to set userId for logged-in user, matomo will take care of the other parameters like _id(which is used to identify the user). However, if I use http API to track the user, I do not have _id, matomo is not able to identify the request is from the same user if I only set uid. So how can I get/query/calculate the _id value for any userId?
Full story:
This issue is raised when I use both JS and http API to track the same site, the reason is that the shopping cart tracking is hard to be done in frontend, so we decided to track it at backend and make use of matomo's http API. It works correctly when only JS client is used. For example in shopping cart tracking, matomo correctly records the revenue left in the cart even if I do a series of shopping cart add/edit/remove. But when I track the same thing using http API, the revenue left in the cart is wrong, all requests are treated as from different users. Let me give a simple example.
Add $10 in cart
Clear cart
Add $20 in cart
JS client gives revenue left in cart to be: $20 (correct)
Http tracking gives revenue left in cart to be :$30 (wrong, since matomo thinks the two add events are from different user)
I've tried to use postman to poke around and found that the actual cause is the _id field. If I set it to the same value and perform the above actions. Revenue calculation is correct. So how can I set the _id value so the same user has same _id in both JS tracking and http tracking?
I am developing an mobile app where I present products (items) from different stores just like ebay.com. User can select product, can add to cart and then finally can make payment via paypal.
I have created an Paypal business account on sandbox. Currently all payment made by users are coming to this business account I mentioned in my code. But my requirement is different. I want that payment should go to store's (product owner's) account.
So I made changes so that whenever i make call to paypal I chnaged business account email to store owner email address and payment done successfully. :) Payment posted to store owner business.
I made changes only in paypal.recipient email address but still paypal object is created by my paypal application ID. This is what I am worried about. Does it will work on production mode? I really doubt that.
Please help me guys!!!
What API or service are you using to do this? Are you just using Website Payments Standard, Exprses Checkout, or one of the other API? You mentiioned application id, are you using Adaptive Payments? You could use Adative Payments to do what you are wanting to, if you are not already doing this. This would allow you to process payments and split it between different accounts. In your business model, it would allow you to split the payments between different store owners if the buyers checkout contained items from different merchants/stores.