|
| 1 | +--- |
| 2 | +title: Get mandate URL |
| 3 | +--- |
| 4 | + |
| 5 | +After a SEPA Direct Debit (SDD) mandate has been declared, you may need to retrieve the mandate information. |
| 6 | +You can retrieve a specific mandate using the **payment mandate ID**. |
| 7 | + |
| 8 | +:::tip Prerequisites |
| 9 | +1. **Mandate declaration:** A SEPA Direct Debit mandate must have been previously declared using the [`addSepaDirectDebitPaymentMandate`](./guide-declare) mutation. |
| 10 | +1. **Mandate ID:** You must know the **unique payment mandate ID** of the mandate you want to retrieve. |
| 11 | +::: |
| 12 | + |
| 13 | +## API {#api} |
| 14 | + |
| 15 | +Queries are customizable. This guide focuses solely on using the `paymentMandate` query to get the mandate URL. |
| 16 | + |
| 17 | +1. Call the `paymentMandate` query. |
| 18 | +2. Add your payment mandate ID (line 2). Include the `SEPAPaymentDirectDebitMandate` fragment with the fields you need (line 3). |
| 19 | +3. Under `SEPAPaymentDirectDebitMandate`, check the boxes for `id`, `name` and `mandateDocumentUrl` (lines 4-6). |
| 20 | + * `mandateDocumentUrl` allows you to receive a **download URL** in the payload. |
| 21 | + |
| 22 | +### Query {#query} |
| 23 | + |
| 24 | +<a href="https://explorer.swan.io/?query=cXVlcnkgR2V0TWFuZGF0ZSB7CiAgcGF5bWVudE1hbmRhdGUoaWQ6ICIkWU9VUl9NQU5EQVRFX0lEIikgewogICAgLi4uIG9uIFNFUEFQYXltZW50RGlyZWN0RGViaXRNYW5kYXRlIHsKICAgICAgaWQKICAgICAgbmFtZQogICAgICBtYW5kYXRlRG9jdW1lbnRVcmwKICAgIH0KICB9Cn0K&tab=api" className="explorer-badge">Open in API Explorer</a> |
| 25 | + |
| 26 | +```graphql {2,3,4-6} showLineNumbers |
| 27 | +query GetMandate { |
| 28 | + paymentMandate(id: "$YOUR_MANDATE_ID") { |
| 29 | + ... on SEPAPaymentDirectDebitMandate { |
| 30 | + id |
| 31 | + name |
| 32 | + mandateDocumentUrl |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +### Payload {#payload} |
| 39 | + |
| 40 | +1. The response includes a mandate name (line 5), and the download URL (line 6). |
| 41 | +1. Paste the URL into your browser, then press enter. This triggers the download of your PDF. |
| 42 | + |
| 43 | +```json {5,6} showLineNumbers |
| 44 | +{ |
| 45 | + "data": { |
| 46 | + "paymentMandate": { |
| 47 | + "id": "$YOUR_MANDATE_ID", |
| 48 | + "name": "B2B/Core SEPA Direct Debit Mandate", |
| 49 | + "mandateDocumentUrl": "$YOUR_MANDATE_URL" |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
0 commit comments