FLUX-SE / PayumStripe

Payum Stripe gateways (with SCA support)
MIT License
28 stars 15 forks source link

Inquiry Regarding Integration and Custom Bank Transfer Titles #44

Open PiotrSzymanski2000 opened 2 months ago

PiotrSzymanski2000 commented 2 months ago

Hello,

We've integrated your plugin into our project, and I wanted to inquire about this integration. Specifically, after integrating, we've noticed that buyers always have the same bank transfer title, which isn't entirely ideal for us. For context, we operate an open marketplace system divided between buyers and sellers, and we utilize Stripe Connect.

In our search for a solution within the Stripe documentation, we came across the statement_descriptor and statement_descriptor_suffix fields in the documentation (https://docs.stripe.com/api/payment_intents/create#create_payment_intent-statement_descriptor_suffix). As it seems, these fields are related to PaymentIntent, whereas in your plugin, we're creating an ApiResource Session instead of a PaymentIntent.

So, my question is, is there a possibility to add these aforementioned fields in the capture action or data provider? Or is there any way to dynamically set the bank transfer title that will be displayed to the customer in their banking application?

Prometee commented 2 months ago

Hello @PiotrSzymanski2000!

A Stripe Checkout Session mode payment is creating a Stripe Payment Intent at the end and the Stripe doc explains how to provide the statement descriptor you need : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-statement_descriptor

If you are using this library without Symfony or Sylius, you have to create your own ConvertPaymentAction or you can also create a Payum extension : ConvertPaymentExtension to add the data you need in the $model:

$modeDataKey = 'payment_intent_data';
$embeddedModeData = $model->offsetGet($modeDataKey);
if (null === $embeddedModeData) {
    $embeddedModeData = [];
}

$embeddedModeData['statement_descriptor'] = 'foo_something';

$model->offsetSet($modeDataKey, $embeddedModeData);

If you are using the Sylius plugin using this lib, then decorate the DetailsProvider to do the same thing.

PiotrSzymanski2000 commented 2 months ago

Hello @Prometee!

Thank you for the information. However, it doesn’t fully solve my problem. I have a decorated DetailsProvider and I'm inputting the required fields, but even when I set $details['self::PAYMENT_INTENT_DATA'] = [ 'statement_descriptor' => 'Seller company', 'statement_descriptor_suffix' => 'SUFFIX', ]; the result in the Stripe dashboard shows as "BUSINES* SUFFIX".

Essentially, what I want to do is this: on my platform, I have sellers and buyers. When a buyer purchases something from a seller, the transaction description on the buyer’s bank statement should match what the seller has set during their Stripe onboarding process. At the moment, this is not how it works.

Therefore, my idea is to retrieve what the seller has set during the Stripe onboarding process and during the creation of the Stripe Connect account, and then send this as part of the payment redirection. Is this approach correct? Also, will I be able to properly check its functionality in Stripe’s test mode?

PiotrSzymanski2000 commented 2 months ago

Hi,

I've noticed an issue regarding the statement descriptor settings for our Stripe accounts. When I create an admin account with the statement descriptor set as "Admin descriptor" and then create a seller account (via Stripe Connect) with the descriptor set as "Seller descriptor," the descriptor that appears on transactions is still "Admin descriptor," even when the transaction is made with product from the seller.

Is this a configuration issue? Both our admin and sellers can sell products; ideally "Admin descriptor" should appear when the product sold does not belong to a seller and "Seller descriptor" when it does. Could you advise on how to configure Stripe to reflect this? Do I need to set this up in DetailsProvider, or is there a way to specify this within Stripe's configuration settings?

Please let me know how to proceed.

Prometee commented 2 months ago

Hi @PiotrSzymanski2000

Technically all can be done in the payment_intent_data data array, then if something is not working properly only the Stripe support team can lead you to the right direction or fix the issue. Unfortunately, I'm not using this feature, but the Stripe support is well reactive and can help you on this.