Some payment methods still require this integration. As we continue to evolve the APIs, check the status of supported payment methods.
The Charges API limits your ability to take advantage of Stripe features. To get the latest features, use Stripe Checkout or migrate to the Payment Intents API. If your current integration doesn’t rely on webhooks, you can follow the synchronous flow migration guide instead.
In most cases, the PaymentIntents API offers more flexibility and integration options.
|Charges API||Payment Intents API|
To refund a payment via the API, create a Refund and provide the ID of the charge to be refunded.
To refund part of a payment, provide an
amount parameter, as an integer in cents (or the charge currency’s smallest currency unit).
- Use the createTokenWithPayment SDK method to turn the
PKPaymentinto a Stripe
- Use this
Tokento create a charge.
Dynamic statement descriptor
By default, your Stripe account’s statement descriptor appears on customer statements whenever you charge their card. Additionally, you can set the statement descriptor dynamically on every charge request with the
statement_descriptor argument on the Charge object.
Statement descriptors are limited to 22 characters, can’t use the special characters
*, and must not consist solely of numbers.
When setting the statement descriptor dynamically on credit and debit card charges, the dynamic portion is appended to the settlement merchant’s statement descriptor (separated by an
* and an empty space). For example, a statement descriptor for a business, named FreeCookies, that includes the kind of cookie purchased might look like
* and empty space count towards the 22 character limit and Stripe automatically allots 10 characters for the dynamic statement descriptor. This means that the settlement merchant’s descriptor might be truncated if it’s longer than 10 characters (assuming the dynamic statement descriptor is also greater than 10 characters). If the dynamic statement descriptor is also greater than 10 characters, both descriptors are truncated at 10 characters.
If you’re having issues with the character limits, you can set a shortened descriptor in the Stripe Dashboard to shorten the settlement merchant’s descriptor. This allows more room for the dynamic statement descriptor. The shortened descriptor:
- Replaces the settlement merchant’s statement descriptor when using dynamic descriptors.
- Can be between 2 and 10 characters.
If you’re not sure what the statement descriptors look like when they’re combined, you can check them in the the Stripe Dashboard.
Storing information in metadata
Stripe supports adding metadata to the most common requests you make, such as processing charges. Metadata isn’t shown to customers or factored into whether or not a charge is declined or blocked by our fraud prevention system.
Through metadata, you can associate other information—meaningful to you—with Stripe activity. Any metadata you include is viewable in the Dashboard (for example, when looking at the page for an individual charge), and is also available in common reports and exports. As an example, your store’s order ID can be attached to the charge used to pay for that order. Doing so allows you, your accountant, or your finance team to easily reconcile charges in Stripe to orders in your system.
If you are using Radar, consider passing any additional customer information and order information as metadata. By doing so, you can write Radar rules using metadata attributes and have more information about the payment available within the Dashboard which can expedite your review process.
If you want your integration to respond to payment failures automatically, you can access a charge’s
outcome in two ways.
- Handle the API error that’s returned when a payment fails. For blocked and card issuer-declined payments, the error includes the charge’s ID, which you can then use to retrieve the charge.
- Use webhooks to monitor status updates. For example, the
charge.failedevent triggers when a payment is unsuccessful.