# Customer Wallet and Credits

Usage based billing requires you wait until the end of the billing cycle to capture revenue from customers. Paigo's Customer wallet and credit feature enables you to have customer's prepay for credits in order to capture revenue. Additionally the flexibility of Paigo's credit system enables you to use it for a variety of use cases beyond just prepaid credits, in cases of customer refunds you can additionally issue the credit as a note to be used for payment on later charges. <br>

## Creating Credits&#x20;

Credits can be created and managed via the UI or API in Paigo.&#x20;

### UI/Dashboard

1. Navigate to app.paigo.tech&#x20;
2. Go to the customer you want to issue credit for
3. Select **Actions > Update Customer Credit**

<div data-full-width="true"><figure><img src="/files/Wb1VgmzHqzUi0eWfvI7M" alt=""><figcaption><p>The Update Credit Screen</p></figcaption></figure></div>

4. Choose to either issue new credit or reduce their current existing credits.&#x20;

   See [#considerations-for-credits](#considerations-for-credits "mention") for implications with negative credits.&#x20;
5. Hit submit.&#x20;

On the main customer page you should see their credit transaction in the Customer Wallet section.&#x20;

<figure><img src="/files/8RxBLsYo67flt1nGtsEL" alt=""><figcaption><p>A customer's credit ledger</p></figcaption></figure>

### API

To make the call to API directly please use or [API documentation](http://www.api.docs.paigo.tech/#tag/Customers/operation/Create%20a%20wallet%20transaction)

### Removing Credits

The process for removing credits is almost exactly the same as issuing credits. When choosing the amount of credits to issue in the UI simply select "Reduce Existing Credits" and reduce the amount of credits a customer has in their wallet. You additionally can provide a `Reason` which is great for tracking why a deduction occurred. \ <br>

<figure><img src="/files/NGedz6AH0CrmQ3ASopyC" alt=""><figcaption><p>Reduce existing creedits option selected</p></figcaption></figure>

## Offerings and Credit

Paigo additionally can automatically add credits to your customer's wallet when they sign up. By selecting a `Free Trial Credit` amount on an offering, when a customer is attached to that offering their credit amount will be added to their wallet to be used at the end of the billing cycle.&#x20;

To add prepaid credits to an offering please select the Credit tab under the create offering. <br>

<figure><img src="/files/DLRPGc74LmrWosqzj8Z4" alt=""><figcaption><p>An offering partially filled out with 1337.00 of free credit. </p></figcaption></figure>

additionally, the same action is available under the `POST /offering` endpoint in the API. See the [docs](http://www.api.docs.paigo.tech/#tag/Offerings/operation/Create%20an%20offering) for more information

### Payments with Credits&#x20;

If a customer has a balance of credits above zero the credits will be used *first* when a payment occurs through Paigo, such as transitioning an Invoice to `Open` status for a `Stripe` Customer. Partial payments for credits will be applied as well. As an example see the following case:&#x20;

#### Partial Credit Payment Example

Suppose your Stripe customer SuperSaaS has $100.00 of credits in Paigo, and at the end of the billing cycle they owe $133.70. Paigo will first subtract the 100.00$ of credits from their account, committing a transaction to the credit ledger with `invoiceId` metadata for traceability. The remaining $33.70 will be charged directly to their associated stripe account with the `invoiceId` as metadata on the payment intent.&#x20;

#### Full Credit Payment Example

In the case where credits exceed the charge required for a customer Paigo will simply substract the credits from their account and not charge their payment channel. For example suppose your customer LinkedOut has $50.00 of credit, and at the end of the billing cycle they have used $42.00 of credit. Paigo will deduct the $42.00 of credit from their wallet and commit the transaction with an `invoiceId` metadata field. No charge will occur on the supported payment channel.&#x20;

### Considerations for Credits

Below are some important considerations when issuing credits for a customer.

* Credits are always issued in the selected currency of a customer, defaulted to `USD` if none is selected on a customer.&#x20;
* Customer's cannot change preferred currency unless their wallet is empty.&#x20;
* Customer's cannot have a negative balance of credits. So if a customer's balance is `5.00` and you want to issue `-6.00 credits` an error will be returned and the ledger will not be updated.&#x20;
* Credits currently have no expire date, but can be negated at anytime by committing a deduction to a customer's wallet.&#x20;


---

# 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.paigo.tech/other/customer-wallet-and-credits.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.
