Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe Destination charge, how to set description for connected account

We build a platform for sellers and customers.

  • The customers should be able to use different payment methods.
  • The sellers should receive money for their invoices, but should not see customer data.

With Stripe, that called a destination charge where the platform charges the customer, but the actual money is routed to the seller. The seller then sees he's been paid the amount, but not by whom (apart from "through our platform").

I'm using Stripe.NET in our C# ASP.NET backend, but my question is not technology related.

I can create a charge to do exactly as described above.

Example code:

var stripeCharge = stripeChargeService.Create(
                new Stripe.ChargeCreateOptions
                    {
                        Amount = (int)(price * multiplier),
                        Currency = currency,
                        CustomerId = stripeCustomer.Id,
                        SourceId = source,
                        Destination = new Stripe.ChargeDestinationCreateOptions 
                                      {
                                          Account = stripeSellerId 
                                      },
                        StatementDescriptor = "PLATFORM: " + invoiceNumber,
                        Description = "PLATFORM Payment for invoice number " + invoiceNumber,
                        Metadata = new Dictionary<string, string> 
                                   {
                                        { "InvoiceNumber", invoiceNumber } 
                                   }
                    });

When I do this, it works. I can see the charge in my platform account. I can see the payment in my seller's account. But the seller does not get any information that I provided. The "Description" and "Metadata" only show up in my platform account's charge. The sellers payment only says "123.45€". Uh... great... who paid their invoice? Matter of fact I don't care who. But which invoice was paid seems to be a core requirement for everybody building a platform or selling on it.

I checked the documentation of Stripe.NET and I checked if maybe it's older than the stripe API itself. But there is no parameter I could set. Nothing in the ChargeDestinationCreateOptions I could set (something like DestinationDescription for example).

The description field for the seller exists, I can see it in the dashboard, but it's empty. So what am I missing?

How do I set the description or metadata of payment the seller can see in their account when doing a "destination charge"?

like image 773
nvoigt Avatar asked Oct 24 '18 12:10

nvoigt


People also ask

Does Stripe charge a fee for connected accounts?

The connected account's balance increases with every charge. Your account balance increases with application fees from every charge. The connected account's balance will be debited for the cost of Stripe fees, refunds, and chargebacks.

Who pays the Stripe fees with destination charges?

Destination charges are created on the platform, but as part of the charge operation, funds are transferred to the connected account specified in the transfer_data[destination] parameter of the charge. The platform is responsible for the cost of the Stripe fees, refunds, and chargebacks.

How do I transfer money from my Stripe connected account?

After the funds are available in your platform's Stripe balance, you can transfer funds to a connected account through the API or the Dashboard. In the Dashboard, transfer funds to a connected account by clicking Send funds in the Balance section of the connected account's detail page.


1 Answers

When you create a destination charge with Stripe, there are three objects created:

  • a charge object(ch_xxx) on the platform account
  • a transfer object(tr_xxx) on the platform account representing the transfer to the destination connected account.
  • a payment object(py_xxx, which is equivalent on an API level to a charge object) on the connected account, representing the funds from the transfer being paid to that account.

From your description, it sounds like it is the third object here that you would like to set metadata or a description on? You're right, you can't do this directly in the parameters of creating a destination charge. However, once the charge is created, you can easily get a reference to the created payment and update it with the needed fields:

var chargeService = new StripeChargeService();
chargeService.ExpandTransfer = true;

var chargeOptions = new StripeChargeCreateOptions
{
    Amount = 1000,
    Currency = "usd",
    SourceTokenOrExistingSourceId = "tok_visa",
    Description = "Payment for Invoice #42",
    Destination = "acct_1DHFyLAXrgjEhAUx",
    DestinationAmount = 800
};
var charge = chargeService.Create(chargeOptions);
var paymentId = charge.Transfer.DestinationPaymentId;
var paymentUpdateOptions = new StripeChargeUpdateOptions
{
    Description = "Payment for Invoice #42"
};
chargeService.Update(paymentId, paymentUpdateOptions, new StripeRequestOptions
{
    StripeConnectAccountId = "acct_1DHFyLAXrgjEhAUx"
});

The key point here is that a charge object links to the transfer, and the transfer links to the payment. So by combining that with the expanding object feature of the API, you can get access to the payment and update it!

like image 105
karllekko Avatar answered Sep 25 '22 03:09

karllekko