Stripe Error – Invalid source object

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM Stripe Error – Invalid source object

Viewing 24 reply threads
  • Author
    Posts
    • #87429
      sdel_nevo
      Participant

      Hi Guys

      I’m starting to get this error in WCF

      DEBUG Error creating customer record with Stripe: Invalid source object: must be a dictionary or a non-empty string. See API docs at https://stripe.com/docs’/strong>

      that transaction is successful and the customer is created in WCFM, but no customer information is created in Stripe

      I will send the srripe error log for this transaction in a private post

      Steve

    • #87430
      sdel_nevo
      Participant
      This reply has been marked as private.
    • #87774
      WCFM Forum
      Member

      Hi,

      Is this happening all the time or happened for a particular transaction?

      Thank You

    • #87776
      sdel_nevo
      Participant

      Hi guys

      It’s happened more often than not

      An order went through without error yesterday correctly

      Two failed with exactly the same issue
      One has gone through last night correctly

      So it appears to be random

      Steve

    • #88370
      WCFM Forum
      Member

      Hi,

      OK, we are debugging this.

      Thank You

    • #88440
      sdel_nevo
      Participant

      Hi Guys

      Many thanks

      Steve

    • #90102
      Jamie O’Reilly
      Participant

      We are having this problem too – please can you tell us what the fix was?

    • #90107
      sdel_nevo
      Participant

      Hi guys

      The devs are still looking into it I believe, I haven’t had an update to it as yet

      Steve

    • #90207
      Jamie O’Reilly
      Participant

      Don’t know if it’s the same with you but this has only happened since we moved to the Per Product Shipping plugin. We’ve found that the first issue appears to be that if customers forget to tick the ‘agree to website terms and conditions’ box and have to be reminded and then tick it, not all of the required information is sent to Stripe which makes the payment fail or at least mess up. We are going to try and write some javascript so that the browser prevents the initial submission if the checkbox hasn’t been checked. That should be a workaround for the first problem but there is though a second problem which is perhaps worse. Those payments that do go through send shipping fee that’s been taken, often to the admin and not the vendor. Sometimes it’s the reverse, the shipping fee goes to the admin but the product payment goes to the vendor – not both to the vendor as it should even though it’s clearly set as a global rule to send the payment minus the commission and the shipping to the vendor. My developer thinks it could be a situation where two messages are racing against each other and only the winning one goes through. It’s beyond my understanding and I’m praying he finds the answer because at the moment it’s chaos. It’s as if the Per Product Shipping plugin just doesn’t recognise the Stripe Connect system at all.

      Would be great if the WC Devs could get involved as this is proving to be a fatal flaw at the moment and creating total chaos.

    • #90226
      sdel_nevo
      Participant

      Hi

      I don’t use the plugin you do, but you may have a point about the terms check box
      It would be good to prevent the submission until the check box has been ticked

      Payments are working in as much as it’s adhering to the global rule, we pass all revenue, shipping and taxes to the vendor.

      Steve

    • #90286
      Jamie O’Reilly
      Participant

      We’ve now discovered that it’s any missing field or mistake made by the customer when at checkout. The second form submission – which is what it is, to Stripe, is missing crucial information. We have implemented a hack which prevents the form content being submitted at all unless it is all completed correctly.

      Here wp-content/plugins/wc-multivendor-marketplace/assets/js/gateway/stripe.js

      we added the following – see attached.

      Attachments:
      You must be logged in to view attached files.
    • #90302
      sdel_nevo
      Participant

      Hi

      Blimey, will take a look and try to implement the hack you’ve suggested

      I’m hoping that the devs can take a look into this and implement a fix into a coming update

      Many thanks

      Steve

    • #90432
      pol.sancho
      Participant

      Same here, waiting for an update on this and on the Vendors stripe connection.
      Automatic Stripe payments is a crucial part of the plugin and it isn’t as reliable as it should!!

    • #90737
      WCFM Forum
      Member

      Hi,

      We’ve now discovered that it’s any missing field or mistake made by the customer when at checkout.

      – That’s right. If checkout from submitted and it has some error then if customer without reload that page trying to submit again then such error coming.

      We are not very sure with that hack, so can not recommend this now!

      We are also debugging this to prevent this error situation.

      Hopefully we will fix this in next update.

      Thank You

    • #90740
      sdel_nevo
      Participant

      Hi Guys

      That will be brilliant 🙂 hopefully, that will prevent more issues going forward

      Steve

    • #90883
      sdel_nevo
      Participant

      Hi Guys

      just had another 5 orders all with the same issue

      payments sent to the vendor correctly

      customer created in the site

      customer is not created in stripe

      all had the same error as the first post

      hope this can be addressed soon, will this affect refunds in any way?

      Steve

    • #90896
      Jamie O’Reilly
      Participant

      Hi

      Sorry I should have explained a bit more about that hack. My developer found this to be the offending code that was causing us to get a missing source error.

      if( ! wcfmmp_stripe_split_pay_form.hasSource() && ! wcfmmp_stripe_split_pay_form.hasToken() ) {

      He explained that when you submit the form this code runs. The second time we still have a token, so it skips doing the stripe setup however because it skips we don’t get a source. The && should be || and that would mean if either are missing it would redo the setup.

      This is where the offending code is located

      wp-content/plugins/wc-multivendor-marketplace/assets/js/gateway/stripe.js

      We left the original in there but commented it out and added the code I attached before in this thread. I have passed this on to the devs at WC Lovers but I appreciate they need to check it out fully first themselves and so you may wish to wait to get their confirmation and the update but thought I should post it anyway.

      It was nothing to do with PEr Product Shipping – that brought it’s own, even more challenging problems.

      Jamie

    • #90901
      sdel_nevo
      Participant

      Hi Jamie

      Thanks for posting

      there are two references to that code I can see, did you change both?

      if( jQuery('input[name=wcfmmp_stripe_customer_id]').length > 0 ) {
      				if ( jQuery('input[name=wcfmmp_stripe_customer_id]:checked').val() == 'new' ) {
      					<strong>if( ! wcfmmp_stripe_split_pay_form.hasSource() && ! wcfmmp_stripe_split_pay_form.hasToken() ) {</strong>
      						e.preventDefault();
      	
      						wcfmmp_stripe_split_pay_form.block();
      						wcfmmp_stripe_split_pay_form.createSource();
      						wcfmmp_stripe_split_pay_form.createToken();
      						
      						// Prevent form submitting
      						return false;
      					}
      				} else {
      					e.preventDefault();
      
      					wcfmmp_stripe_split_pay_form.block();
      					wcfmmp_stripe_split_pay_form.form.append( "<input type='hidden' class='stripe-source' name='stripe_source' value='" + jQuery('input[name=wcfmmp_stripe_customer_id]:checked').val() + "'/>" );
      					wcfmmp_stripe_split_pay_form.createToken();
      					
      					// Prevent form submitting
      					//return false;
      				}
      			} else {
      				<strong>if( ! wcfmmp_stripe_split_pay_form.hasSource() || ! wcfmmp_stripe_split_pay_form.hasToken() ) {</strong>
      					e.preventDefault();
      
      					wcfmmp_stripe_split_pay_form.block();
      					wcfmmp_stripe_split_pay_form.createSource();
      					wcfmmp_stripe_split_pay_form.createToken();
      					
      					// Prevent form submitting
      					return false;
      				}
      			}
      		},

      or just the last one?

      I’m a bit nervous about this to be honest, I’m worried I could do more harm than good by changing it

      Steve

    • #90902
      sdel_nevo
      Participant

      sorry tried to highlight the code but it’s just put tags around it lol
      this isn’t in my code

      Steve

    • #91063
      sdel_nevo
      Participant

      Hi Jamie

      I have changed the line of code you mentioned, I have had another 6 orders this morning all with the same issue
      hopefully, this change will fix it, I’m getting hammered with this now

      changed if( ! wcfmmp_stripe_split_pay_form.hasSource() && ! wcfmmp_stripe_split_pay_form.hasToken() ) { to if( ! wcfmmp_stripe_split_pay_form.hasSource() || ! wcfmmp_stripe_split_pay_form.hasToken() ) {

      for the line after the else clause

      Steve

    • #91461
      Jamie O’Reilly
      Participant

      Hi Steve

      Sorry for not getting back to you sooner. Did adding the new code resolve it for you?

      We found another bug as well that was messing up the destination of the shipping fee and the commission in Stripe so had to hack that too.

      Jamie

    • #91463
      sdel_nevo
      Participant

      Hi mate

      Yes I have added the code, I’ve had 15 orders gone through without error at all 😀 since applying the change

      I did have the system set so that an account had to be created when purchasing I have also removed that requirement and enabled guest checkout in Woo-commerce

      I’ve had no problems since, so perhaps the issue was as you suggested

      I will have to check this file when the devs update the system

      Many thanks again

      Steve

    • #91469
      Jamie O’Reilly
      Participant

      Pleased to hear it. Yes be careful it doesn’t get overwritten – you might want to keep a copy somewhere.

      Think I saw somewhere you were asking about Per Product Shipping as well. We’ve gone down this route recently. Happy to share thoughts if helpful.

      Jamie

    • #91500
      sdel_nevo
      Participant

      Hi Mate

      I may drop you a line about the shipping, I see you have has some issues with that

      Steve

    • #96873
      sdel_nevo
      Participant

      hi Jamie

      “We found another bug as well that was messing up the destination of the shipping fee and the commission in Stripe so had to hack that too.”

      what issue was that mate, I have a problem with the shipping commission, that I can’t get my head around,

      this may be related

      Steve

Viewing 24 reply threads
  • The topic ‘Stripe Error – Invalid source object’ is closed to new replies.