podkrepi-bg / api

Nest.js REST backend for charity platform Podkrepi.bg https://podkrepi.bg/swagger
https://podkrepi.bg
MIT License
82 stars 43 forks source link

[subscriptions] Find way to attach metadata to donations made with subscription #495

Open igoychev opened 1 year ago

igoychev commented 1 year ago

Which area(s) of Podkrepi.bg are affected? (leave empty if unsure)

No response

Describe the Bug

The stripe invoice payment events are correctly attributing the donations with subscription,

However in Stripe Admin UI the regular subscription payments don't display the metadata and it is very difficult to find to which campaign they were made when doing cross-check audits.

Now that we migrated to latest version of API, we should find a way to include the metadata in the subscription creation so that it is sent with the payment.

To Reproduce

make a subscription donation and observe the payment intent does not contain the metadata.

Expected Behavior

A subscription donation payment to contain the campaign-id like the one-time donations.

Which browser are you using? (if relevant)

No response

slavcho commented 1 year ago

I've send an inquiry to the stripe support. They've responded and asked for some examples... will post updates here.

slavcho commented 1 year ago

Basically the answer is - no. We cannot send metadata to the payment intent from the subscription. This is the answer I got from the support.

"Metadata which has been set on an object generally is not “inherited” by or copied to associated objects which are created at the same time." "There are some important exceptions..." "Additionally, the metadata of an Invoice’s Line Items will be copied from the metadata of the Subscription the Invoice belongs to, for Invoice Line Items where type: ‘subscription.’"

https://support.stripe.com/questions/how-metadata-works-with-related-objects

So the invoice metadata is an exception.

I think we should create some export (or tool) internally that allow the accounting team to do match the data from stripe with the data from our db. It should not be that difficult...

slavcho commented 1 year ago

I believe this helped mitigate the problem. We now have the campaign id in the donations export. The finance are happy with. https://github.com/podkrepi-bg/api/pull/498

We can probably close this.