# Post a Credit Transaction
source: https://developer.mastercard.com/mastercard-processing-core/documentation/use-cases/transactions-and-fees-management/post-credit-trans/index.md

## Overview {#overview}

The use case describes how you generate an internal (besides transactions originating from payment schemes) credit transaction to the contract.

## Sequence diagram {#sequence-diagram}

Diagram post-credit-trans

### Explanation {#explanation}

1. The server sends a `POST` request to the `/contracts/{contract_id}/credits` endpoint by passing the required fields `amount`, `currency`, `description`, and `transactionTypeCode` in the request body. To post a transaction for the account contract or card contract, the server must put the `accountContractId` or the `cardContractId`, respectively, in place of the `contract_id` in the path. Note: The `transactionTypeCode` is preconfigured in the Mastercard Processing CMS system during the onboarding process. Refer to [Transactions and Documents](https://developer.mastercard.com/mastercard-processing-core/documentation/guides/transactions-and-documents/index.md) for more information.
2. The API returns the HTTP status `201` with the `transactionId` generated by the CMS.

Tip: If you attempt to post a transaction with the `creditContract` API that exceeds the specified usage limit, a `USAGE_LIMIT_EXCEEDED` ReasonCode error will be thrown. The error description will include the `usageLimitCode` that you can use to retrieve the given usage limit parameters set in the CMS and to adjust the limit's parameters using the `setUsageLimit` API to successfully complete the `creditContract` API. Refer to [Usage limits management](https://developer.mastercard.com/mastercard-processing-core/documentation/guides/usage-limits/index.md) for more information.

Refer to [Sandbox testing](https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/transactions-and-fees-management/post-credit-trans/index.md) for information on how to execute the use case in the Sandbox environment.

## Endpoint {#endpoint}


API Reference: `POST /contracts/{contract_id}/credits`

