# Handling credit card sources

In the Digital River API, sources created from credit cards are [multi-use](/digital-river-api/payments/payment-sources.md#reusable-or-single-use), [synchronous](/digital-river-api/payments/payment-sources.md#synchronous-or-asynchronous), and [pull-based](/digital-river-api/payments/payment-sources.md#pull-or-push). This means that customers aren't required to re-enter payment details before every payment; they are provided instant notification of a payment's approval status, and the amount charged to the card can be updated repeatedly throughout the checkout process.

The Sources API supports a [wide range of credit cards](/digital-river-api/payments/payment-sources.md#payment-methods).

## Creating a credit card source

To ensure that you remain PCI compliant, credit card Source objects are [created by DigitalRiver.js](/digital-river-api/payments/payment-integrations-1/digitalriver.js/quick-start.md#step-1-include-digitalriver-js-on-your-page) and then returned to your integration.

You must [include the DigitalRiver.js library](/digital-river-api/payments/payment-integrations-1/digitalriver.js/quick-start.md#step-1-include-digitalriver-js-on-your-page) on your payment collection form to create a credit card source. You then [create your payment form](/digital-river-api/payments/payment-integrations-1/digitalriver.js/quick-start.md#step-2-create-your-payment-form) and [embed elements](/digital-river-api/payments/payment-integrations-1/digitalriver.js/quick-start.md#step-3-create-and-embed-elements) on it. Once a customer has supplied payment details, you pass the data to DigitalRiver.js to [create the payment source](/digital-river-api/payments/payment-integrations-1/digitalriver.js/quick-start.md#step-4-use-digitalriver-js-to-create-a-payment-source). We then return a source identifier to your integration.

## Charging a credit card source

You can either [attach the Source to a Customer](/digital-river-api/payments/payment-sources/using-the-source-identifier.md#attaching-sources-to-customers) for use in the current Checkout and potentially reuse it in future payments or [attach it directly to a Checkout](/digital-river-api/payments/payment-sources/using-the-source-identifier.md#attaching-sources-to-checkouts). In the latter case, the Source cannot be reused and will have a [state](/digital-river-api/payments/payment-sources.md#source-state) of `consumed` once charged.

{% hint style="danger" %}
Credit card sources should be used shortly after they are created. This is because CVC data expires within a few minutes. Orders created with cards that lack CVCs are more likely to be declined and pose a greater fraud risk.
{% endhint %}

Once you have attached the Source to a Customer or directly to a Checkout, Digital River can then use it to create a [Charge object](https://docs.digitalriver.com/digital-river-api-reference/2021-12-13/charges/charge-basics) when you [submit an Order](/digital-river-api/order-management/creating-and-updating-an-order.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/digital-river-api/payments/payment-sources/handling-credit-card-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
