Update a source 

Payment Methods
Sources
Update a source

Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.

Parameters

  • amountinteger

    Amount associated with the source.

  • metadataobject

    Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

  • ownerobject

    Information about the owner of the payment instrument that may be used or required by particular source types.

    • owner.addressobject

      Owner’s address.

      • owner.address.citystring

        City, district, suburb, town, or village.

      • owner.address.countrystring

        Two-letter country code (ISO 3166-1 alpha-2).

      • owner.address.line1string

        Address line 1 (e.g., street, PO Box, or company name).

      • owner.address.line2string

        Address line 2 (e.g., apartment, suite, unit, or building).

      • owner.address.postal_codestring

        ZIP or postal code.

      • owner.address.statestring

        State, county, province, or region.

    • owner.emailstring

      Owner’s email address.

    • owner.namestring

      Owner’s full name.

    • owner.phonestring

      Owner’s phone number.

More parameters

  • mandateobject

    Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.

    • mandate.acceptanceobject

      The parameters required to notify Stripe of a mandate acceptance or refusal by the customer.

      • mandate.acceptance.statusstringRequired

        The status of the mandate acceptance. Either accepted (the mandate was accepted) or refused (the mandate was refused).

      • mandate.acceptance.datetimestampRequired

        The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer.

      • mandate.acceptance.ipstring

        The IP address from which the mandate was accepted or refused by the customer.

      • mandate.acceptance.offlineobject

        The parameters required to store a mandate accepted offline. Should only be set if mandate[type] is offline

        • mandate.acceptance.offline.contact_emailstringRequired

          An email to contact you with if a copy of the mandate is requested, required if type is offline.

      • mandate.acceptance.onlineobject

        The parameters required to store a mandate accepted online. Should only be set if mandate[type] is online

        • mandate.acceptance.online.datetimestampRequired

          The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer.

        • mandate.acceptance.online.ipstringRequired

          The IP address from which the mandate was accepted or refused by the customer.

        • mandate.acceptance.online.user_agentstringRequired

          The user agent of the browser from which the mandate was accepted or refused by the customer.

      • mandate.acceptance.typestring

        The type of acceptance information included with the mandate. Either online or offline

      • mandate.acceptance.user_agentstring

        The user agent of the browser from which the mandate was accepted or refused by the customer.

    • mandate.amountinteger

      The amount specified by the mandate. (Leave null for a mandate covering all amounts)

    • mandate.currencyenum

      The currency specified by the mandate. (Must match currency of the source)

    • mandate.intervalstring

      The interval of debits permitted by the mandate. Either one_time (just permitting a single debit), scheduled (with debits on an agreed schedule or for clearly-defined events), or variable(for debits with any frequency)

    • mandate.notification_methodstring

      The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either email (an email is sent directly to the customer), manual (a source.mandate_notification event is sent to your webhooks endpoint and you should handle the notification) or none (the underlying debit network does not require any notification).

  • source_orderobject

    Information about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.

    • source_order.itemsarray of objects

      List of items constituting the order.

      • source_order.items.parentstring

        The ID of the SKU being ordered.

      • source_order.items.quantityinteger

        The quantity of this order item. When type is sku, this is the number of instances of the SKU to be ordered.

    • source_order.shippingobject

      Shipping address for the order. Required if any of the SKUs are for products that have shippable set to true.

      • source_order.shipping.addressobjectRequired

        Shipping address.

        • source_order.shipping.address.line1stringRequired

          Address line 1 (e.g., street, PO Box, or company name).

        • source_order.shipping.address.citystring

          City, district, suburb, town, or village.

        • source_order.shipping.address.countrystring

          Two-letter country code (ISO 3166-1 alpha-2).

        • source_order.shipping.address.line2string

          Address line 2 (e.g., apartment, suite, unit, or building).

        • source_order.shipping.address.postal_codestring

          ZIP or postal code.

        • source_order.shipping.address.statestring

          State, county, province, or region.

      • source_order.shipping.carrierstring

        The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.

      • source_order.shipping.namestring

        Recipient name.

      • source_order.shipping.phonestring

        Recipient phone (including extension).

      • source_order.shipping.tracking_numberstring

        The tracking number for a physical product, obtained from the delivery service. If multiple tracking numbers were generated for this purchase, please separate them with commas.

Returns

Returns the source object if the update succeeded. This call will raise an error if update parameters are invalid.

POST /v1/sources/:id
curl https://api.stripe.com/v1/sources/src_1N3lxdLkdIwHu7ixPHXy8UcI \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \
-d "metadata[order_id]"=6735
Response
{
"id": "src_1N3lxdLkdIwHu7ixPHXy8UcI",
"object": "source",
"ach_credit_transfer": {
"account_number": "test_eb829353ed79",
"bank_name": "TEST BANK",
"fingerprint": "kBQsBk9KtfCgjEYK",
"refund_account_holder_name": null,
"refund_account_holder_type": null,
"refund_routing_number": null,
"routing_number": "110000000",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_ZaOIRUD8a9uGmQobLxGvqKSr",
"created": 1683144457,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {
"order_id": "6735"
},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "110000000-test_eb829353ed79",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable"
}