Duplicate customer in Stripe laravel - laravel

I started today Stripe in Laravel 6. I used below code and ran it two times.
$stripeCustomer = $this->User->createOrGetStripeCustomer();
As per the instructions here same user can't be created two times but after running the code 2 times, it created the duplicate customer.
Please check the screenshot below.
Can I delete the customer from stripe? I saw the Laravel library. But seems like there is no delete stripe customer function in cashier
Am I missing anything? Why did it create the duplicate customer?

Related

Canceling Stripe subscription throws scheduling error

I recently increased the prices of my Stripe subscription plans on my Laravel SASS application. Now, when a user cancels their subscription, it throws the following error:
"The subscription is managed by the subscription schedule sub_sched_XXXXXXXXXX, and updating any cancelation behavior directly is not allowed. Please update the schedule instead."
I'm using Laravel 5.6 and have this in my composer.json file:
"laravel/cashier": "~7.0",
Basically, I get the subscription object and just call cancel(). E.g.:
$subscription->cancel();
This worked for years until I recently changed my prices. Is this a programming error on my part, or do I need to move my subscription plans off of schedules somehow? I'm really stumped here, because Googling has not turned up any useful results on this error.
Found the issue. The recent price change moved the subscriptions onto a schedule. I had to release the subscription schedule using the API here:
https://stripe.com/docs/api/subscription_schedules/release?lang=php

PayPal REST API not returning recurring payment information in laraval

I am working on Paypal webhook (subscription) section to insert recurring payment information into the database. I have done coding based on the link "https://jslim.net/blog/2018/01/22/PayPal-Rest-API-with-Laravel-5-and-Angular/" but Paypal webhook always return “payment_status: Pending” on sandbox image and its not inserting recurring payment information into the database (insert option added in PayPalController - function webhooksPaymentSaleCompleted ).
I think the problems related with routes/api.php file but I can't figure out what exactly is going wrong.
Another URL that I have referred and tried was "https://github.com/supermavster/PayPal-PHP-SDK"
Laravel version 5.8
paypal/rest-api-sdk-php: "^1.14"
Please suggest a feasible solution to this problem.
Thanks in advance.
Verify that the sandbox account's email is confirmed, by logging into the sandbox business account receiving the payment and navigating to: https://www.sandbox.paypal.com/businessprofile/settings/email
Resend the confirmation message. Open the message via https://developer.paypal.com/developer/notifications/ , and confirm the sandbox email.
The v1 PayPal-PHP-SDK is deprecated and there is no reason to be using it for a new integration. Use the v2 Checkout-PHP-SDK for payments.
You'll need two routes on your server, one for 'Set Up Transaction' and one for 'Capture Transaction', documented here; https://developer.paypal.com/docs/checkout/reference/server-integration/
The best approval flow to pair it with is https://developer.paypal.com/demo/checkout/#/pattern/server

while charging one time on stripe laravel facing error

i am using cashier 10 and stripe 7 and i am creating monthly, yearly and life time subscription.
Montlhy and Yealry subscription is working fine but life time charge generate error
The provided PaymentMethod is already attached to another object. You cannot reuse PaymentMethods without attaching them to a Customer object first.
in controller
$user->charge((int)$request->plan_price*100, $request->paymentMethod);

Laravel Cashier Subscriptions for Featured Posts

I am currently using Laravel Cashier for my users so they can subscribe for premium accounts.
I also want to let any user make Featured Posts that are different from regular posts.
I want to charge the user $10/week for a featured post. I assume a Laravel Cashier subscription would work for this.
But I do not know how to link the Post, the User, and the Subscription together with Laravel Cashier.
Ideally there would be a post_id field in the subscriptions table. But there is not.
I need a way to check if a post is a featured post and if the user who owns the post has paid for it (the subscription is active)
With Laravel Cashier I can check if a user is subscribed for a premium account, but I don't know how to check if a post is subscribed to be featured by the post owner.
Does anyone know how this can be done?

Stripe Subscription problems with Laravel 4.2

I have been using cashier to create subscriptions for a couple sites but when I tried to implement it again in an new app it's not working. I am getting Stripe Notice: Undefined property of Laravel\\Cashier\\Customer instance: default_card. Is there an update to Cashier or a property/code I need to change to make it work again?
I have the BillableTrait attached to the School Model and am trying to subscribe to a subscriptions (in Stripe) using $school->subscribe($input['school_plan'])->create($input['stripeToken']);
The solution is to add 'version' => '2014-06-17' to the services.php page for the Stripe info array. It requests the older API and successfully works.

Resources