# Create deposit

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

* :credit\_card: Credit and debit card deposits with the following integrations:
  * :heavy\_check\_mark: Fragments all-in-one solution
  * :heavy\_check\_mark: OneShot redirect
* :dollar: Alternative payment methods.
  {% endhint %}

## Create a deposit request

> Create a deposit request collecting and sending the information needed. We will return you with the information required to create the checkout on your own website or redirect the user to the checkout page .

```json
{"openapi":"3.0.0","servers":[{"url":"https://api-stg.onekeypayments.com","description":"Staging server"}],"paths":{"/v3/deposits":{"post":{"summary":"Create a deposit request","description":"Create a deposit request collecting and sending the information needed. We will return you with the information required to create the checkout on your own website or redirect the user to the checkout page .","operationId":"createDeposit","tags":["[POST] Create a deposit"],"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,"content":{"application/json":{"schema":{"type":"object","required":["country","amount","invoice_id","currency","payer","payment_method"],"properties":{"country":{"type":"string","description":"Country of the deposit."},"amount":{"type":"number","format":"double","description":"Amount of the deposit."},"invoice_id":{"type":"string","description":"Unique deposit ID on your side."},"currency":{"type":"string","description":"Currency of the deposit."},"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. (Present in example, not in table)."}}},"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."}}},"payment_method":{"type":"string","description":"Payment method code. Codes can be obtained from payment methods endpoint, or our coverage page"},"token_requested":{"type":"string","description":"Used to define if merchant want to receive the checkout_token in response in order to display Fragments SDK all-in-one."},"card_identifier":{"type":"string","description":"Used to generate a transaction in the payer's card stored in our vault."},"allow_installments":{"type":"boolean","description":"Used to indicate if the deposit should allow installments (in a credit card transaction). The options will be displayed to the user."},"sub_merchant_id":{"type":"integer","format":"int64","description":"Used to specify for which SubMerchant ID the deposit will be created."},"back_url":{"type":"string","format":"url","description":"HTTPS URL used to redirect the customer in case of cancelling the deposit."},"success_url":{"type":"string","format":"url","description":"HTTPS URL used to redirect the customer in case of success."},"error_url":{"type":"string","format":"url","description":"HTTPS URL used to redirect the customer in case of error while generating the payment."},"notification_url":{"type":"string","format":"url","description":"HTTPS URL used to send the notifications about deposit's change of status."},"payment_types":{"type":"array","items":{"type":"string"}},"request_payer_data_on_validation_failure":{"type":"boolean","description":"Flag specifying if you want to ignore errors because of invalid phone, zip_code and/or city's state."},"bonus_amount":{"type":"number","format":"double","description":"Used to show the customer a bonus amount (Pay 100, receive 120)."},"bonus_relative":{"type":"boolean","description":"Used to define if the bonus_amount was specified as an absolute value or as a percentage."},"strikethrough_price":{"type":"number","format":"double","description":"Used to show the customer a strikethrough amount."},"description":{"type":"string","description":"Description of the deposit."},"client_ip":{"type":"string","format":"ip","description":"Valid IPv4/6 Address of the customer."},"device_id":{"type":"string","description":"Unique customer's device ID created using our JS library."},"language":{"type":"string","description":"Language of the view page."},"logo":{"type":"string","format":"url","description":"HTTPS URL used as the Merchant logo on our cashier page."},"test":{"type":"boolean","description":"Used to mark a deposit as test. If true, the deposit will not affect the merchant's balance."},"mobile":{"type":"boolean","description":"Used to specify if the redirection will be made on a mobile device."},"expiration":{"type":"number","description":"Used to express, in minutes, how long after its creation the deposit should expire. Cannot be more than the default expiration of the payment method."},"early_release":{"type":"boolean","description":"Used to specify if the deposit should be released earlier."},"fee_on_payer":{"type":"boolean","description":"Used to specify if you want to let the customer assume the deposit fee."}}}}}},"responses":{"201":{"description":"Deposit successfully initiated. The response structure varies based on the checkout type (e.g., HOSTED or ONE_SHOT).","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Response structure for a successfully initiated deposit with a ONE_SHOT checkout type, including payment information.","properties":{"checkout_type":{"type":"string","description":"The type of checkout flow initiated."},"redirect_url":{"type":"string","format":"url","description":"The URL to redirect the user to, if applicable."},"deposit_id":{"type":"integer","format":"int64","description":"The unique identifier for the deposit transaction."},"user_id":{"type":"string","description":"The unique identifier for the user associated with the deposit."},"merchant_invoice_id":{"type":"string","description":"The merchant's unique invoice identifier for this deposit."},"payment_info":{"type":"object","description":"Detailed information about the payment method and transaction specifics.","properties":{"type":{"type":"string"},"payment_method":{"type":"string"},"payment_method_name":{"type":"string"},"amount":{"type":"number","format":"double"},"currency":{"type":"string"},"expiration_date":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"metadata":{"type":"object","description":"Additional metadata related to the payment.","properties":{"payer_document":{"type":"string"},"payer_document_type":{"type":"string"},"reference":{"type":"string"},"show_terms_conditions":{"type":"boolean"},"digitable_line":{"type":"string","description":"The digitable line for boleto or similar payment slips."},"qr_code":{"type":"string","description":"Base64 encoded QR code image for the payment, typically as a data URI."}}}}}}},{"type":"object","description":"Response structure for a successfully initiated deposit with a HOSTED checkout type.","properties":{"checkout_type":{"type":"string","description":"The type of checkout flow initiated."},"redirect_url":{"type":"string","format":"url","description":"The URL to redirect the user to for completing the payment in a hosted environment."},"deposit_id":{"type":"integer","format":"int64","description":"The unique identifier for the deposit transaction."},"user_id":{"type":"string","description":"The unique identifier for the user associated with the deposit."},"merchant_invoice_id":{"type":"string","description":"The merchant's unique invoice identifier for this deposit."}}}]}}}},"400":{"description":"Field validation error. Check details","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}}}}}}}}}}
```

{% 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 %}
