#data-paymentintent-refund

1 messages ยท Page 1 of 1 (latest)

cursive hingeBOT
fringe iron
indigo flax
#

So how do I alter this: var service = new PaymentIntentService();
service.Capture("pi_3NIEDSEVoNb8mE921NTyCQEx");

#

To include the amount that I want to capture AND the account ID that it is associated with?

#

Does this look right?

#

var service = new PaymentIntentService();

var options = new CaptureOptions
{
AmountToCapture = 2000, // Custom amount in cents (e.g., $20.00)
TransferData = new PaymentIntentTransferDataOptions
{
Destination = "acct_1234567890", // Replace with your account ID
}
};

service.Capture("pi_3NIEDSEVoNb8mE921NTyCQEx", options);

fringe iron
#

Looks right

#

Have you tested it?

#

You can try it out in test mode

indigo flax
#

Testing now

#

question when this line executes above:

#

service.Capture(paymentIntentID, options);

#

Does that return the status of what happened?

fringe iron
#

I think so

#

I'm not a .net expert though

#

Recommend you just try it

cursive hingeBOT
indigo flax
#

Also im getting this: "Received unknown parameter: transfer_data[destination]"}

fringe iron
#

Can you send the request id?

indigo flax
#

How do I get that

#

That is my code and its hitting the catch with the exception pasted above

astral island
fringe iron
indigo flax
#

Hmm maybe I am doing it wrong then. I am using standard accounts - I have the account ID of which the money needs to be captured. The current status of the payment intent ID is requires_capture and I would like to capture a specific amount from the payment how should I go about doing this are there any code examples that include the capture amount as well as the account ID that it needs

astral island
#

But any funds that remain after your capture attempt will be automatically refunded to the customer

indigo flax
#

Yes that makes sense

#

Thank you

astral island
#

Great ๐ŸŽ‰ Happy to help ๐Ÿ™‚

indigo flax
#

Question

#

How do I do that exact thing just with refunding

#

Do you have a link to that as well

astral island
#

What do you mean? Just generate a refund instead of capturing any funds?

indigo flax
#

No after you capture funds - you can then refund if needed

#

Lets say you have a payment hold of $100 and you capture $50 of it

#

Then you want to refund $25 of the $50 that was captured

astral island
#

No the refund is automatic

#

For any funds you didn't capture

#

It's covered in the document I linked

indigo flax
#

Yeah I know that

#

But you can then refund the amount you captured

#

"Lets say you have a payment hold of $100 and you capture $50 of it
Then you want to refund $25 of the $50 that was captured"

astral island
cursive hingeBOT
astral island
indigo flax
#

Why is that throwing an error?

astral island
indigo flax
#

You cant refund using a payment intent ID?

astral island
#

The API expects a Charge ID

trail lodge
#

data-paymentintent-refund

indigo flax
#

same thing

#

Im shocked there is no way to refund using a payment intent ID

trail lodge
#

it's right there in our docs

#

Seems to be an issue with your IDE and the way you configured stripe-dotnet locally on your machine, but it definitely works in the API and the library

indigo flax
#

Then why is it saying no definition of PaymentIntent in RefundCreateOptions

#

I am on an older version but I need to be on that version.

trail lodge
#

Then you need to figure out how this worked in your old version in that case

indigo flax
#

Is there documentation on that?

trail lodge
#

No we don't have documentation for old versions of the library. Which exact version are you on?

indigo flax
#

29.4.0

#

BEcause I am using .NET 4.5

#

Here is the exact error:

trail lodge
#

I understand but what youy need to do is try!

#

Download that exact version and look at the code to see what's in it. It takes a few seconds really

#

that version is multiple years old, it's normal that it doesn't support any of the new features

#

We made a lot of changes in our library over the years, especially renaming a lot of properties and classes to be consistent across all APIs. If you are on that old version you will have to regularly look up the source code to find the parameters/properties you need as they won't match what our docs explain.

indigo flax
#

okay gotcha thank you.

#

What is the best way to get the charge ID from a payment intent?

#

does this look right?

#

var service2 = new PaymentIntentService();
var paymentIntent = service2.Get(paymentIntentID);

            // Access the latest Charge ID
            string latestChargeId = paymentIntent.Charges.Data[0].Id;
trail lodge
#

yes

#

You can also use AddExtraParam which would be easier


var options = new RefundCreateOptions
{
};
options.AddExtraParam("payment_intent", "pi_123");
var service = new RefundService();
service.Create(options);```
#

that lets you pass parameters not yet supported in your library

indigo flax
#

OHHH

#

thats cool

#

will it still work with no chargeid

trail lodge
#

yes because our API supports both options

indigo flax
#

Is it: options.AddExtraParam("payment_intent", paymentIntentID); or options.AddExtraParam("PaymentIntent", paymentIntentID);

#

Just asking because in the refundcreateoptions its PaymentIntent = ....

trail lodge
#

it's what I wrote exactly

indigo flax
#

aweosme thank you so much!

trail lodge
#

when you use AddExtraParam, you have to use the exact path our API would

indigo flax
#

That is so useful to know that the addextraparam works on old versions

trail lodge
indigo flax
#

to include new version api stuff!

#

super cool!!

trail lodge
#

but really you need to figure out how to upgrade as soon as possible