Karl Erik Hofseth

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Problem with SCA-enabled cards #20617
    Karl Erik Hofseth
    Participant

    Tested and succeeded. Don’t know how you want to handle this with presumably customers on both sides of the API update, but there’s the fix.

    in reply to: Problem with SCA-enabled cards #20616
    Karl Erik Hofseth
    Participant

    Ok, so a quick scan of the code later lands me in

    function wp_travel_generate_payment_response( $intent ) {
    	if ( 'requires_source_action' === $intent->status &&
    	'use_stripe_sdk' === $intent->next_action->type ) {
    		// Tell the client to handle the action.
    		echo wp_json_encode(
    			array(
    				'id'                           => $intent->id,
    				'requires_action'              => true,
    				'payment_intent_client_secret' => $intent->client_secret,
    			)
    		);
    	} elseif ( 'succeeded' === $intent->status ) {
    		// The payment didn’t need any additional actions and completed!
    		// Handle post-payment fulfillment.
    		echo wp_json_encode(
    			array(
    				'id'                           => $intent->id,
    				'success'                      => true,
    				'payment_intent_client_secret' => $intent->client_secret,
    			)
    		);
    	} else {
    		// Invalid status.
    		http_response_code( 500 );
    		echo wp_json_encode( array( 'error' => 'Invalid PaymentIntent status' ) );
    	}
    	die;
    }

    It seems to be looking out for the status “requires_source_action”, but the API is returning an object with status “requires_action” as well as next_action->type = “use_stripe_sdk”. Thus the code skips to the else block and throws a 500 error.

    Digging in the Stripe docs reveals a name change in API version 2019-02-11 “requires_source_action is now requires_action”, so a simple rename in the code above should fix it. I’ll test and report back.

    in reply to: Problem with SCA-enabled cards #20615
    Karl Erik Hofseth
    Participant

    So I’ve updated the server from PHP 7.2 to 7.3, no effect.

    Replaced the square braces with array() also to no effect.

    I looked into the error code, and I can’t find it in Stripe’s docs, confirming my suspicion that Stripe isn’t generating these errors. Currently looking at the plugin code to see if I can make sense of it.

Viewing 3 posts - 1 through 3 (of 3 total)