> For the complete documentation index, see [llms.txt](https://docs.cashramp.co/cashramp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cashramp.co/cashramp/hosted-ramp/withdrawals.md).

# Withdrawals

## Initiate Withdrawal

Create a hosted **withdrawal** with the `initiateHostedPayment` mutation.

```graphql
mutation {
  initiateHostedPayment(
    paymentType: withdrawal
    amount: 100
    currency: usd
    countryCode: "NG"
    reference: "test_ref_1"
    metadata: { customer_id: "" }
    redirectUrl: "https://useaccrue.com"
    firstName: "Clinton"
    lastName: "Mbah"
    email: "test@useaccrue.com"
  ) {
    id
    hostedLink
    status
  }
}
```

### Arguments

<table><thead><tr><th width="134.77777099609375">Name</th><th width="104">Type</th><th width="98.4444580078125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>paymentType</code></td><td><code>Enum</code></td><td><strong>Yes</strong></td><td>Must be <code>withdrawal</code>.</td></tr><tr><td><code>amount</code></td><td><code>Decimal</code></td><td><strong>Yes</strong></td><td>The USD equivalent you want to off-ramp to a customer's local currency.</td></tr><tr><td><code>currency</code></td><td><code>Enum</code></td><td><strong>Yes</strong></td><td><code>usd</code>. The local currency equivalent your customer will receive is determined by the <code>countryCode</code>.</td></tr><tr><td><code>countryCode</code></td><td><code>String</code></td><td><strong>Yes</strong></td><td>ISO-3166 alpha-2 code of the customer's country (e.g., <code>NG</code>).</td></tr><tr><td><code>reference</code></td><td><code>String</code></td><td>No</td><td>Your idempotent reference for reconciliation.</td></tr><tr><td><code>metadata</code></td><td><code>JSON</code></td><td>No</td><td>Arbitrary key–value data echoed in webhooks.</td></tr><tr><td><code>redirectUrl</code></td><td><code>String</code></td><td>No</td><td>URL to send the customer to after payment.</td></tr><tr><td><code>firstName</code></td><td><code>String</code></td><td><strong>Yes</strong></td><td>Customer's first name.</td></tr><tr><td><code>lastName</code></td><td><code>String</code></td><td><strong>Yes</strong></td><td>Customer's last name.</td></tr><tr><td><code>email</code></td><td><code>String</code></td><td><strong>Yes</strong></td><td>Customer's email address.</td></tr></tbody></table>

### Response

<table><thead><tr><th width="122.33331298828125">Field</th><th width="105.33331298828125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td><code>ID!</code></td><td>Global ID of the payment request.</td></tr><tr><td><code>hostedLink</code></td><td><code>String!</code></td><td>URL of the hosted checkout page—redirect the customer here.</td></tr><tr><td><code>status</code></td><td><code>Enum!</code></td><td>Current state of the request (values below).</td></tr></tbody></table>

`status` values:

* **`created`** — Payment request has been created.
* **`picked_up`** — We've received the crypto payment and assigned your customer an agent to withdraw through.
* **`completed`** — Withdrawal succeeded.
* **`canceled`** — Request was cancelled by the customer or via dispute resolution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.cashramp.co/cashramp/hosted-ramp/withdrawals.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
