# Funding
source: https://developer.mastercard.com/mastercard-send-account-info/documentation/use-cases/funding/index.md

This example shows how the API can be used when a digital wallet user adds funds to their wallet account from their card. It is based on the graphical [Top up a digital wallet from a card](https://developer.mastercard.com/mastercard-send-experience-design-guide/documentation/design/funding/top-up-digital-wallet-from-card/) flow in the Mastercard Send Experience Design Guide.

### Scenario {#scenario}

* Ali Young (the Sender) is using a mobile wallet app and wants to add money to her wallet ('top up'). She chooses to transfer $100 USD to the wallet.
* Ali has already added her card account details to her wallet profile. She will send the funds from that card.
* You (the Transaction Initiator) provide the app and use the Mastercard Send APIs to transfer the funds from the card account (the sending account).

Successful API requests result in a 200 response. If requests fail API validation, Mastercard Send returns a 4xx error message with the appropriate [error code](https://developer.mastercard.com/mastercard-send-account-info/documentation/code-and-formats/index.md#error-codes).

## Check a new card {#check-a-new-card}

If Ali adds a new sending (funding) card to the app, use an [Account Info PUT](https://developer.mastercard.com/mastercard-send-account-info/documentation/api-reference/index.md) request to check that card account. Example sequence:
Diagram mastercard-send-sequence-account-info-funding-1

Example request payload:
* JSON
* XML

```JSON
{
  "account_info": {
    "account_uri": "pan:5102589999999913;exp=2077-08;cvc=123",
    "payment_type": "SWL",
    "enhanced_response": "true"
  }
}
```

```XML
<account_info>
   <account_uri>pan:5102589999999913;exp=2077-08;cvc=123</account_uri>
   <payment_type>SWL</payment_type>
   <enhanced_response>true</enhanced_response>
</account_info>
```

These success response fields show that Ali's card can send funds:
* JSON
* XML

```JSON
    "sending_eligibility": {
      "eligible": true
    },
```

```XML
   <sending_eligibility>
      <eligible>true</eligible>
   </sending_eligibility>
```

Using the response information, your app can:

* Notify Ali that the card can be used to top up the wallet.
* Provide textual or graphical information about the card account in the user interface (e.g. brand, type, and institution) to enhance the experience, such as show an issuer-specific card image.

## Check a funding transfer {#check-a-funding-transfer}

When Ali initiates the $100 USD top up transfer, use an [Account Info PUT](https://developer.mastercard.com/mastercard-send-account-info/documentation/api-reference/index.md) request to check that her sending card account is eligible for that funding transfer. Example sequence:
Diagram mastercard-send-sequence-account-info-funding-2

Example request payload:
* JSON
* XML

```JSON
{
  "account_info": {
    "account_uri": "pan:5102589999999913;exp=2077-08",
    "amount": "10000",
    "currency": "USD",
    "payment_type": "SWL"
  }
}
```

```XML
<account_info>
   <account_uri>pan:5102589999999913;exp=2077-08</account_uri>
   <amount>10000</amount> 
   <currency>USD</currency>
   <payment_type>SWL</payment_type>
</account_info>
```

These success response fields show that Ali's card can send these funds:
* JSON
* XML

```JSON
    "sending_eligibility": {
      "eligible": true
    },
```

```XML
   <sending_eligibility>
      <eligible>true</eligible>
   </sending_eligibility>
```

Your app can continue with the wallet top up flow.

You can use the [Mastercard Send Funding](https://developer.mastercard.com/mastercard-send-funding/documentation/) service to secure the funds from Ali's sending account.
