Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Stripe Error – Invalid source object
Tagged: missing source error, per product shipping
- This topic has 24 replies, 4 voices, and was last updated 5 years ago by sdel_nevo.
- AuthorPosts
- October 17, 2019 at 10:38 pm #87429sdel_nevoParticipant
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
- October 17, 2019 at 10:39 pm #87430sdel_nevoParticipantThis reply has been marked as private.
- October 20, 2019 at 10:42 am #87774WCFM ForumMember
Hi,
Is this happening all the time or happened for a particular transaction?
Thank You
- October 20, 2019 at 10:50 am #87776sdel_nevoParticipant
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 correctlySo it appears to be random
Steve
- October 23, 2019 at 9:58 am #88370WCFM ForumMember
Hi,
OK, we are debugging this.
Thank You
- October 23, 2019 at 11:46 am #88440sdel_nevoParticipant
Hi Guys
Many thanks
Steve
- November 1, 2019 at 5:42 pm #90102Jamie O’ReillyParticipant
We are having this problem too – please can you tell us what the fix was?
- November 1, 2019 at 5:51 pm #90107sdel_nevoParticipant
Hi guys
The devs are still looking into it I believe, I haven’t had an update to it as yet
Steve
- November 2, 2019 at 4:12 am #90207Jamie O’ReillyParticipant
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.
- November 2, 2019 at 5:01 am #90226sdel_nevoParticipant
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 tickedPayments are working in as much as it’s adhering to the global rule, we pass all revenue, shipping and taxes to the vendor.
Steve
- November 2, 2019 at 3:44 pm #90286Jamie O’ReillyParticipant
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. - November 2, 2019 at 5:04 pm #90302sdel_nevoParticipant
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
- November 3, 2019 at 3:53 pm #90432pol.sanchoParticipant
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!! - November 5, 2019 at 3:38 pm #90737WCFM ForumMember
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
- November 5, 2019 at 3:41 pm #90740sdel_nevoParticipant
Hi Guys
That will be brilliant 🙂 hopefully, that will prevent more issues going forward
Steve
- November 5, 2019 at 8:27 pm #90883sdel_nevoParticipant
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
- November 5, 2019 at 9:54 pm #90896Jamie O’ReillyParticipant
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
- November 5, 2019 at 10:06 pm #90901sdel_nevoParticipant
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
- November 5, 2019 at 10:07 pm #90902sdel_nevoParticipant
sorry tried to highlight the code but it’s just put tags around it lol
this isn’t in my codeSteve
- November 6, 2019 at 2:01 pm #91063sdel_nevoParticipant
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 nowchanged 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
- November 8, 2019 at 11:34 pm #91461Jamie O’ReillyParticipant
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
- November 8, 2019 at 11:39 pm #91463sdel_nevoParticipant
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
- November 8, 2019 at 11:42 pm #91469Jamie O’ReillyParticipant
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
- November 9, 2019 at 2:04 am #91500sdel_nevoParticipant
Hi Mate
I may drop you a line about the shipping, I see you have has some issues with that
Steve
- December 10, 2019 at 4:01 pm #96873sdel_nevoParticipant
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
- AuthorPosts
- The topic ‘Stripe Error – Invalid source object’ is closed to new replies.