# Create deposit (credit card operations)

{% hint style="success" %}
This deposit creation endpoint is used only for

* Credit and debit cards deposits with the following integrations:
  * :heavy\_check\_mark: Server2Server
  * :heavy\_check\_mark: Fragments Lite
    {% endhint %}

## Create a deposit (credit card operations only)

> Allow merchants to create credit card operations by sending credit card details, card token or card identifier.

```json
{"openapi":"3.0.0","servers":[{"url":"https://cc-api-stg.onekeypayments.com","description":"Staging environment"}],"paths":{"/v3/deposits":{"post":{"summary":"Create a deposit (credit card operations only)","description":"Allow merchants to create credit card operations by sending credit card details, card token or card identifier.","tags":["PCI Deposits"],"parameters":[{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","default":"application/json"},"description":"Media type of the body sent to the API."},{"in":"header","name":"X-Date","required":true,"schema":{"type":"string","format":"date-time"},"description":"ISO8601 Datetime with Timezone (yyyy-MM-dd'T'HH:mm:ssZ)."},{"in":"header","name":"X-Login","required":true,"schema":{"type":"string"},"description":"Merchant X-Login API Key."},{"in":"header","name":"Authorization","required":true,"schema":{"type":"string"},"description":"Authorization control hash."},{"in":"header","name":"X-Idempotency-Key","required":false,"schema":{"type":"string"},"description":"Unique idempotency key for ensuring that the same request is not processed more than once."}],"requestBody":{"required":true,"description":"Request body for creating a PCI deposit.","content":{"application/json":{"schema":{"type":"object","description":"Details for creating a PCI deposit.","required":["country","amount","currency","invoice_id","payer","client_ip"],"properties":{"country":{"type":"string","minLength":2,"maxLength":2,"description":"Country code of the deposit in ISO 3166-1 alpha-2 code format."},"amount":{"type":"number","format":"double","description":"Deposit amount in the currency specified. Up to 18 integers and 2 decimal places."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"Currency code of the amount in ISO 4217 format."},"installments":{"type":"integer","format":"int32","description":"Number of installments in which the deposit will take place. *Check eligibility with your commercial contact.","minimum":1,"maximum":12},"invoice_id":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9-_]*$","description":"Unique deposit ID on the merchant end."},"external_subscription_id":{"type":"string","maxLength":128,"description":"ID of the generated subscription on your end, that will be charged to the card_identifier. This field is mandatory when creating a subscription with card_identifier."},"payer":{"type":"object","description":"Object containing details about the payer.","required":["document","document_type","email","first_name","last_name"],"properties":{"id":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9]*$","description":"Customer's ID generated on your end. Recommended. If none is sent, we will autogenerate it."},"document":{"type":"string","maxLength":30,"description":"Customer's document ID."},"document_type":{"type":"string","maxLength":10,"description":"Customer's document type."},"email":{"type":"string","format":"email","maxLength":255,"description":"Valid customer's email address."},"first_name":{"type":"string","maxLength":128,"description":"Customer's first name."},"last_name":{"type":"string","maxLength":128,"description":"Customer's last name."},"address":{"type":"object","description":"Customer's address details.","properties":{"street":{"type":"string","maxLength":255,"description":"Customer's street."},"city":{"type":"string","maxLength":128,"description":"Customer's city."},"state":{"type":"string","maxLength":3,"description":"Customer's state code in ISO 3166-2 code format."},"zip_code":{"type":"string","description":"Customer's zip code."}}},"phone":{"type":"string","maxLength":32,"description":"Valid customer's phone number."},"birth_date":{"type":"string","pattern":"^\\d{8}$","description":"Customer's birthdate in format YYYYMMdd. E.g 19880910."}}},"credit_card":{"type":"object","description":"Object containing the credit card details.","properties":{"cvv":{"type":"string","pattern":"^\\d{3,4}$","description":"Credit card CVV/CVV2 code (3 or 4 digits)."},"card_number":{"type":"string","minLength":13,"maxLength":20,"description":"The credit card number (13 to 20 digits). Validated by Luhn Algorithm."},"expiration_month":{"type":"string","pattern":"^(0[1-9]|1[0-2])$","description":"Credit card expiration month (MM)."},"expiration_year":{"type":"string","pattern":"^\\d{2}$","description":"Credit card expiration year, last two digits (YY)."},"holder_name":{"type":"string","maxLength":256,"description":"The name of the credit card holder."},"payment_mode":{"type":"string","maxLength":50,"description":"Used for multiplo cards (Brazil) to charge 'CREDIT' or 'DEBIT' based on client preference."}}},"card_token":{"type":"string","maxLength":50,"description":"Card Token generated with Cards SDK Without User Interface. Typically used if `credit_card` object is not provided."},"card_identifier":{"type":"string","maxLength":50,"description":"Card Identifier generated with Cards-on-file API. Typically used if `credit_card` object is not provided."},"sub_merchant_id":{"type":"integer","format":"int64","description":"Used to specify for which SubMerchant ID the deposit will be created."},"three_domain_secure":{"type":"object","description":"Object containing the 3DS Authentication details from external provider.","properties":{"cavv":{"type":"string","description":"The cardholder authentication value for the 3D Secure authentication session. The returned value is a base64-encoded 20-byte array."},"eci":{"type":"string","description":"The electronic commerce indicator. Accepted values `01` and `02` for Mastercard and `05` and `06` for Visa and Amex."},"transaction_id":{"type":"string","description":"The transaction identifier assigned by the 3DS Server for v2 authentication (36 characters, commonly in UUID format)."},"specification_version":{"type":"string","description":"The 3DS Authentication version. Accepted from `2.0.0` onwards."}}},"description":{"type":"string","maxLength":100,"description":"Transaction description. It could be shown on the customer's credit card extract."},"client_ip":{"type":"string","description":"Valid IPv4 or IPv6 Address of the customer."},"device_id":{"type":"string","maxLength":100,"description":"Unique customer's device ID. Used to identify and prevent fraud."},"fee_on_payer":{"type":"boolean","default":false,"description":"Choose if the deposit's fee will be paid by the customer or debited from your balance."}}}}}},"responses":{"200":{"description":"Successful operation. The transaction outcome is indicated by the `payment_info.result` field.\nRefer to the `PaymentInfo` schema, specifically the `result` field description, for detailed explanations of possible transaction statuses and their implications (e.g., `SUCCESS`, `REJECTED`, `PENDING_AUTHENTICATION`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PCIDepositResponse"}}}},"400":{"description":"Bad Request - Field validation error or invalid request structure.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"PCIDepositResponse":{"type":"object","description":"Response structure for a PCI deposit creation request.","required":["deposit_id","merchant_invoice_id","payment_info"],"properties":{"deposit_id":{"type":"integer","format":"int64","description":"ID of the deposit generated on our end. Store this ID for future reference."},"user_id":{"type":"string","description":"ID of the user. If you didn't send it, it is generated by us."},"merchant_invoice_id":{"type":"string","description":"ID of the deposit on your end. If you didn't send it, it is generated by us."},"payment_info":{"$ref":"#/components/schemas/PaymentInfo"},"authentication_url":{"type":"string","format":"url","nullable":true,"description":"URL to display to the end-user to complete 3DS Authentication. Present if 3DS authentication is required (e.g., when `payment_info.result` is `PENDING_AUTHENTICATION`)."}}},"PaymentInfo":{"type":"object","description":"Object containing the information about the payment.","properties":{"type":{"type":"string","description":"Type of transaction (Always CREDIT_CARD for this endpoint)."},"result":{"type":"string","description":"Status of the transaction. Possible values include:\n- **SUCCESS**: The transaction was successfully processed.\n- **REJECTED**: The transaction was rejected. The `reason` and `reason_code` fields in this `PaymentInfo` object will provide more details.\n- **PENDING_AUTHENTICATION**: 3DS authentication is required from the payer. The main response object (PCIDepositResponse) will include an `authentication_url` to redirect the user.\n- **IN_PROGRESS**: Payment is currently being processed, typically awaiting confirmation from an external provider (e.g., provider-side 3DS authentication). An `authentication_url` may be present in the main response object if user interaction is still possible or required.","enum":["SUCCESS","REJECTED","PENDING_AUTHENTICATION","IN_PROGRESS"]},"reason":{"type":"string","nullable":true,"description":"Transaction result reason. Shown in case of rejection or certain pending statuses."},"reason_code":{"type":"string","nullable":true,"description":"Code of the result reason. Shown in case of rejection or certain pending statuses."},"payment_method":{"type":"string","description":"Payment method code."},"payment_method_name":{"type":"string","description":"Payment method name."},"amount":{"type":"number","format":"double","nullable":true,"description":"Amount sent to the card acquirer."},"currency":{"type":"string","nullable":true,"description":"Currency of the amount sent to the card acquirer."},"created_at":{"type":"string","format":"date-time","description":"Transaction date."}}},"ErrorResponse":{"type":"object","description":"Standard error response structure for 400 errors.","required":["code","description"],"properties":{"code":{"type":"integer","description":"Error code."},"description":{"type":"string","description":"Description of the error."},"details":{"type":"array","items":{"type":"string"},"nullable":true,"description":"Details about the errors. Shown in case of invalid details."},"type":{"type":"string","nullable":true,"description":"Error code name. Not always shown."}}}}}}
```

{% hint style="info" %}

### Error codes

For more information regarding error codes, please visit <a href="api-codes" class="button primary">API Codes</a> page
{% endhint %}
