You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
anniel-stripe edited this page May 2, 2023
·
4 revisions
Stripe's Node.js bindings allow you to pass additional options in the form of an object after the required arguments to any given method, and additional parameters for when the method's first argument is a string.
Additional Parameters
The stripe.charges.refund() (documentation) method has a single required argument: the chargeId (ID of the charge that you wish to refund). The simplest way to use this method is to pass the chargeId in as an argument:
stripe.charges.refund(chargeId);
There are additional optional arguments though:
amount
refund_application_fee
These are passed as an object in the second argument:
For methods where all arguments are optional, e.g. the stripe.events.list() method (documentation), you would simply pass them all in via an object as the first argument:
maxNetworkRetries - set the maximum amount of network retries for this request;
timeout - set the maximum time in ms before the request times out;
host - set the hostname for this particular request
This options object can be included as the last argument for any method:
// Just the Charge ID and an Idempotency Key:stripe.charges.refund(chargeId,{idempotencyKey: refundIdempotencyKey,});// All of the Charge ID, additional parameters, and an Idempotency Key:stripe.charges.refund(chargeId,{amount: 500,},{stripeAccount: connectedAccountId,});