• Resolved mikethome

    (@mikethome)


    Our site uses TerraWallet plugin for users to use ‘points’ to purchase. When the user does not have enough points to complete the order they are allowed to pay remaining balance with credit card. We are using Stripe and your plugin to process these payments. However, the payment object is sent to Stripe with the currency as ‘points’ instead of ‘usd’. Where can I hardcode ‘usd’ for all payments sent to Stripe?

    We already have the following code added to our functions.php in our child theme, however it’s not working. Thoughts?

    add_filter(‘wc_stripe_payment_intent_args’, function($args){ $args[‘currency’] = ‘USD’; return $args; }, 10);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Saif

    (@babylon1999)

    Hello @mikethome,

    Thank you for reaching out!

    Our site uses TerraWallet plugin for users to use ‘points’ to purchase. When the user does not have enough points to complete the order they are allowed to pay remaining balance with credit card. We are using Stripe and your plugin to process these payments. However, the payment object is sent to Stripe with the currency as ‘points’ instead of ‘usd’. Where can I hardcode ‘usd’ for all payments sent to Stripe?

    Custom requests are not something we can assist with per our support policy I’m afraid.

    If the ‘points’ amount is the same as the USD amount you want to charge, you can try changing the currency value using the wc_stripe_generate_create_intent_request filter.

    https://github.com/woocommerce/woocommerce-gateway-stripe/blob/a4684e93d7238a10ac242e1593ff0af933066b2d/includes/abstracts/abstract-wc-stripe-payment-gateway.php#L1289C5-L1289C5

    If you require the assistance of a developer, consider hiring one of the vetted WooExpert agencies we work with.

    Hope this helps!

    Thread Starter mikethome

    (@mikethome)

    Saif,

    Thanks for the reply. Literally found our fix 5 minutes before you posted.

    Inside woocommerce /wp-content/plugins/woocommerce/includes is the class-wc-checkout.php file. Line 433 we changed to:

    $order->set_currency( strtolower(get_woocommerce_currency()) == ‘points’ ? ‘USD’ : get_woocommerce_currency() );

    It appears to be working! If anyone sees an issue with making this modification (aside from having to modify every time there is an update), please let me know.

    Hey there @mikethome,

    Thank you so much for adding your input! Some of our customers might indeed find this guide helpful!

    We appreciate you being an active part of the community ??

    I’m going to mark this thread as resolved now. If you have any further questions, feel free to open a new thread.

    Have a wonderful day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hardcode ‘usd’ as currency’ is closed to new replies.