2

I am using Laravel Cashier and while working on creating a stripe subscription and when I try to pay using failed test card number 4000008260003178 then it is going in my catch() but creating a subscription with Incomplete payment and Invoice is Open.

try {
    return $subscription = $member->newSubscription('main', $planId)->withMetadata($metaArray)->create($paymentMethod);    
} catch (IncompletePayment $exception) {
    ErrorLog::create(['module'=>'Stripe payment error: ,'error'=>$exception->payment->id."-".$exception->getMessage()]);
    return false;
}

So, when I again try in my frontend to pay using correct card. I am getting below Javascript error. Could you all please guide how to resolve this error. I am really getting stuck in this from long time. Eagerly looking for your help.

error: {code: "setup_intent_unexpected_state",…}
code: "setup_intent_unexpected_state"
doc_url: "https://stripe.com/docs/error-codes/setup-intent-unexpected-state"
message: "You cannot update this SetupIntent because it has already succeeded."
setup_intent: {id: "seti_1GdZmxIG6uR48z4R5hRjLsFp", object: "setup_intent", cancellation_reason: null,…}
cancellation_reason: null
client_secret: "seti_1GdZmxIG6uR48z4R5hRjLsFp_secret_HBxiiqS1kVmCTmzUMWtdUOmOENsEKEc"
created: 1588243123
description: null
id: "seti_1GdZmxIG6uR48z4R5hRjLsFp"
last_setup_error: null
livemode: false
next_action: null
object: "setup_intent"
payment_method: "pm_1GdZnCIG6uR48z4Ro4OQbcLO"
payment_method_types: ["card"]
status: "succeeded"
usage: "off_session"
type: "invalid_request_error"
verjas
  • 1,793
  • 1
  • 15
  • 18
  • Sounds like you're creating subscriptions with incomplete subscriptions enabled. That's [documented here](https://stripe.com/docs/billing/subscriptions/overview#incomplete), and you can also [specify the behavior](https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior) for incomplete subscriptions on creation. – taintedzodiac Apr 30 '20 at 13:40
  • 1
    I am using laravel cashier and it automatically create a subscription with incomplete status. Didn't find option to set payment_behaviour... – Neema Tiwari Apr 30 '20 at 14:36

0 Answers0