Add support for setting a default payment description in the gateway configuration

Created on 27 July 2023, over 1 year ago
Updated 8 July 2024, 5 months ago

I am using Commerce currency resolver to switch currency (USD & Indian Rupee). When I am going to buy product in indian rupee then its working find, but when i am using USD currency for same product then its showing below error.

As per Indian regulations, export transactions require a description. More info here: https://stripe.com/docs/india-exports

Kindly help me how to solve this usse

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Closed: works as designed

Version

1.0

Component

User interface

Created by

🇮🇳India sumit22kalra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sumit22kalra
  • For anyone trying to make it work for INR/Stripe India

    1. Go to commerce_stripe/src/Plugin/Commerce/PaymentGateway
    2. Edit Stripe.php
    3. Add Description like below

    $default_intent_attributes = [
    'amount' => $this->minorUnitsConverter->toMinorUnits($amount),
    'currency' => strtolower($amount->getCurrencyCode()),
    'payment_method_types' => ['card'],
    'metadata' => [
    'order_id' => $order->id(),
    'store_id' => $order->getStoreId(),
    ],
    'description' => 'Your Transaction Description',

  • 🇺🇸United States rszrama

    I don't really see how the module would know when or how to set this value, but it wouldn't be a bad idea to make the description field available in the payment gateway settings. I propose the following:

    1. Add an optional "Default payment description" / default_payment_description setting to both payment gateway configuration forms. Give it the help text, "Sent to Stripe when creating a payment intent. Required for some transaction types such as international payments."
    2. If the gateway has a value for this setting, include it in the $default_intent_attributes.

    Note: this description field can already be set from a custom event subscriber via the StripeEvents::PAYMENT_INTENT_CREATE, so we don't need any sort of alter hook here ... the module already supports adding custom properties to the payment intent.

  • Status changed to Closed: works as designed 5 months ago
  • 🇺🇸United States TomTech

    Since the description will vary per order/transaction, e.g. "Software Services", "Initial Setup", etc... this appears to be beyond the scope of what this module can provide.

    A likely implementation would probably have a "transaction description" field on product variations (or products), and then an EventSubscriber could update the PaymentIntent based on the order items.

Production build 0.71.5 2024