内容简介:To refund a payment via the Dashboard:Alternatively, you can go to the Dashboard page for the specific payment, and click
Canceling and refunding payments
Learn how to cancel or refund a payment.
Stripe supports the ability to refund charges made to your account, either in whole or in part. If the original charge underwentcurrency conversion, the refunded amount isconverted back using the same process. There are no fees to refund a charge, but the fees from the original charge are not returned.
We submit refund requests to your customer’s bank or card issuer immediately. Your customer sees the refund as a credit approximately 5-10 business days later, depending upon the bank. Once issued, a refund cannot be canceled. Disputes and chargebacks aren’t possible on credit card charges that are fully refunded.
We’ll also send an email to your customer notifying them of the refund, if all of these conditions apply:
-
The original charge was created on a
Customer
object in your Stripe account -
The
Customer
object has a stored email address - You have Email customers for refunds enabled
Some refunds—those issued shortly after the original charge—appear in the form of a reversal instead of a refund. In the case of a reversal, the original charge drops off the customer’s statement, and a separate credit is not issued.
Issuing refunds
Refunds can be issued via theAPI or theDashboard and are processed immediately. Once issued, a refund cannot be canceled.
You can issue more than one refund against a charge, but you cannot refund a total greater than the original charge amount.
Using the API
To refund a payment via the API, create aRefund and provide the ID of the charge to be refunded.
When you use a PaymentIntent to collect payment from a customer, Stripe creates acharge behind the scenes. To refund the customer’s payment after the PaymentIntent has succeeded,create a refund using the PaymentIntent, which is equivalent to refunding the underlying charge. You can also optionally refund part of their payment by specifying an amount. You can perform refundswith the API or through the Dashboard .
Note that this does not apply if you are using separate authorization and capture
, and you wish to refund a PaymentIntent that has a status of requires_capture
. In this case, the charge attached to the PaymentIntent is still uncaptured and cannot be refunded directly. You shouldcancel the PaymentIntent instead.
curl https://api.stripe.com/v1/refunds \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d payment_intent=pi_Aabcxyz01aDfoo
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
refund = Stripe::Refund.create({
payment_intent: 'pi_Aabcxyz01aDfoo',
})
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
refund = stripe.Refund.create(
payment_intent='pi_Aabcxyz01aDfoo',
)
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$re = \Stripe\Refund::create([
'payment_intent' => 'pi_Aabcxyz01aDfoo',
]);
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Refund refund = Refund.create(RefundCreateParams.builder()
.setPaymentIntent("pi_Aabcxyz01aDfoo")
.build());
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
(async () => {
const refund = await stripe.refunds.create({
payment_intent: 'pi_Aabcxyz01aDfoo',
});
})();
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
refundParams := &stripe.RefundParams{
PaymentIntent: "pi_Aabcxyz01aDfoo",
}
r, err := refund.New(refundParams)
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var refunds = new RefundService();
var refundOptions = new RefundCreateOptions {
PaymentIntent = "pi_Aabcxyz01aDfoo"
};
var refund = refunds.Create(refundOptions);
To refund part of a PaymentIntent, provide an amount
parameter, as an integer in cents (or the charge currency’s smallest currency unit):
curl https://api.stripe.com/v1/refunds \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d payment_intent=pi_Aabcxyz01aDfoo \
-d amount=1000
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
refund = Stripe::Refund.create({
amount: 1000,
payment_intent: 'pi_Aabcxyz01aDfoo',
})
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
refund = stripe.Refund.create(
amount=1000,
payment_intent='pi_Aabcxyz01aDfoo',
)
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$re = \Stripe\Refund::create([
'amount' => 1000,
'payment_intent' => 'pi_Aabcxyz01aDfoo',
]);
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
Refund refund = Refund.create(RefundCreateParams.builder()
.setAmount(1000L)
.setPaymentIntent("pi_Aabcxyz01aDfoo")
.build());
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
(async () => {
const refund = await stripe.refunds.create({
amount: 1000,
payment_intent: 'pi_Aabcxyz01aDfoo',
});
})();
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
refundParams := &stripe.RefundParams{
Amount: 1000,
PaymentIntent: "pi_Aabcxyz01aDfoo",
}
r, err := refund.New(refundParams)
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var refunds = new RefundService();
var refundOptions = new RefundCreateOptions {
PaymentIntent = "pi_Aabcxyz01aDfoo",
Amount = 1000
};
var refund = refunds.Create(refundOptions);
Canceling a PaymentIntent
You cancancel a PaymentIntent if you no longer intend to use it to collect payment from the customer. Canceling a PaymentIntent is optional, and it’s okay to keep a PaymentIntent in an incomplete status like requires_confirmation
or requires_payment_method
. Incomplete PaymentIntents are useful in understanding the conversion rate at checkout.
curl https://api.stripe.com/v1/payment_intents/pi_cEf8tuXaAwpj7Sr1uhDa/cancel \
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-X POST
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
intent = Stripe::PaymentIntent.cancel('pi_cEf8tuXaAwpj7Sr1uhDa')
# Set your secret key. Remember to switch to your live secret key in production!
# See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
intent = stripe.PaymentIntent.cancel('pi_cEf8tuXaAwpj7Sr1uhDa')
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
$intent = \Stripe\PaymentIntent::retrieve('pi_cEf8tuXaAwpj7Sr1uhDa');
$intent->cancel();
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
PaymentIntent intent = PaymentIntent.retrieve("pi_cEf8tuXaAwpj7Sr1uhDa");
intent.cancel();
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
(async () => {
await stripe.paymentIntents.cancel('pi_cEf8tuXaAwpj7Sr1uhDa')
})();
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
intent, err := paymentintent.Cancel("pi_cEf8tuXaAwpj7Sr1uhDa", nil)
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc";
var service = new PaymentIntentService();
var options = new PaymentIntentCancelOptions{};
var intent = service.Cancel("pi_cEf8tuXaAwpj7Sr1uhDa", options);
A PaymentIntent can only be canceled when it has one of the following statuses: requires_payment_method
, requires_capture
, requires_confirmation
, or requires_action
—a PaymentIntent can’t be canceled while it is actively processing or once it has succeeded.
When a PaymentIntent is canceled, you can no longer use it to perform additional charges. Any operations that your application attempts to perform on a canceled PaymentIntent will fail with an error.
Using the Dashboard
To refund a payment via the Dashboard:
- Find the payment to be refunded in thepayments overview page.
- Click the ••• icon to the right of the charge. From the resulting menu, select Refund payment .
- By default, you will issue a full refund. For a partial refund, enter a different amount to be refunded.
- Select a reason for the refund. If you select Other , you must provide an explanatory note that is attached to the refund.
- Click Refund .
Alternatively, you can go to the Dashboard page for the specific payment, and click Refund there. (Again, you’ll be given the choice of a full or partial refund and prompted to pick a reason.)
Refund destinations
Refunds can be sent back only to the original payment method used in a charge. It’s not possible to send a refund to a different destination (e.g., another card or bank account).
Refunds to expired or canceled cards are handled by the customer’s card issuer and, in most cases, credited to the customer’s replacement card. If no replacement exists, the card issuer usually delivers the refund to the customer using an alternate method (e.g., check or bank account deposit). In rare cases, a refund back to a card may.
For additional payment methods (ACH,iDEAL, etc.), refund handling can vary from bank to bank. If a customer has closed their method of payment, the bank may return the refund to us—at which point it is marked as.
Handling failed refunds
A refund can fail if the customer’s bank or card issuer has been unable to process it correctly (e.g., a closed bank account or a problem with the card). The bank returns the refunded amount to us and we add it back to your Stripe account balance. This process can take up to 30 days from the post date.
TheRefund object’s status transitions to failed
and includes these attributes:
-
failure_reason
, the reason why the refund failed -
failure_balance_transaction
, the ID of thebalance transaction representing the amount returned to your Stripe balance
In the rare instance that a refund fails, we notify you using the charge.refund.updated
webhook event. You will then need to arrange an alternative way of providing your customer with a refund.
Was this page helpful?
Thank you for helping improve Stripe's documentation. If you need help or have any questions, please considercontacting support.
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。