Hello @shalintj ,
Thank you for using Direct Stripe.
If you need to set a query arg and use redirections, you can use the “Extra query arguments” option at Direct Stripe -> Settings under the Buttons settings tab.
See https://screenshots.firefox.com/jeijRJjo2VLXIeUh/newo.me
Otherwise you can use Actions or Filter hooks to set functions using payments data. https://newo.me/direct-stripe-actions-and-filters-hooks/
For example the ‘direct_stripe_before_success_redirection’ action.
Best wishes,
Thanks for the super quick reply.
Sorry! That didn’t work. Here’s a demo page for the same:
https://checkout.videodojo.co/70-2/
Here’s what Stripe logs say: https://cl.ly/3f96b8a5455b
From what I understand, I think we will have to pass this ‘cross_border_classification’ right when the first request is submitted to Stripe along with card details, name etc.
Hey Nicolas. Were you able to look into this?
Thanks for your help. Much appreciated.
Hello @shalintj ,
You can do that using the ‘direct_stripe_charge_data’ filter hook, https://newo.me/direct-stripe-actions-and-filters-hooks
Adding metadata parameter to the charge data, you’ll find more about that at https://stripe.com/docs/api/charges/create?lang=php#create_charge-metadata
Best wishes
Thanks Nicolas. I did read the filter and hooks guide. A quick query. In which file do I make these changes provided that I want to collect recurring (subscription) as well as one-off payments to. That will go inside theme’s functions.php. Right?
Also, I know I’m asking for too much… But if you can really help me out with this, that’d be really great. Can you help me with gist/code that I can put in my functions.php?
-
This reply was modified 6 years ago by
shalintj.
UPDATE:
I added the following to functions.php. It still didn’t work. Looks like I’m doing something wrong:
add_filter('direct_stripe_charge_data', function($cross_border_classification) {
$cross_border_classification = 'export';
} );
-
This reply was modified 6 years ago by
shalintj.
Hello @shalintj ,
It’ normal your code doesn’t work, you need to edit the data sent to Stripe charge via the filter hook.
I made an example at https://gist.github.com/New0/ead135a857b6cfb2949de99a321d5bf9
You can then edit this example to match the data you need to pass and / or restrict the data to a precise button using css button ID passed through the filter as fourth parameter.
Best,
It worked perfect! Thanks a ton 🙂
Also, is there any reason the Stripe dashboard does not show the name? It only shows the email address but in the Stripe modal, it does ask for the name.
Do you mean the name asked for billing information ?
The billing information is printed in Payments in the payment method block.
If you want to add those to the customer it requires using a hook 😉
Got it. Thanks a lot Nicolas. You have been very kind and helpful… Thanks…
Hello Nicolas and Shalintj
I am setting up a ecom store. When I am trying to do a test charge then its showing cross_border_classification error. I have tried everything even what you guys have provided here but its not working. I have tried both direct stripe and the stripe integrated in woocommerce but its not working. Please help me on how to do it and where to do it. Please guys help me.
Hello @lavbhelloriya,
Thank you for using Direct Stripe.
Could you open a new issue explaining what you tried, what you want to achieve and what is not working ?
The cross_border_classification was really specific to shalintj project and I doubt you need it.
Kind regards,