Skip to content

Dedicated accounts

DedicatedAccountClient

Bases: BaseAPIClient

Provides a wrapper for paystack Dedicated Virtual Account API

The Dedicated Virtual Account API enables Nigerian merchants to manage unique payment accounts of their customers. https://paystack.com/docs/api/dedicated-virtual-account/

Note

This feature is only available to businesses in Nigeria.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
class DedicatedAccountClient(BaseAPIClient):
    """Provides a wrapper for paystack Dedicated Virtual Account API

    The Dedicated Virtual Account API enables Nigerian merchants to manage
    unique payment accounts of their customers.
    https://paystack.com/docs/api/dedicated-virtual-account/


    Note:
        This feature is only available to businesses in Nigeria.
    """

    def create(
        self,
        customer: str,
        preferred_bank: str | None = None,
        subaccount: str | None = None,
        split_code: str | None = None,
        first_name: str | None = None,
        last_name: str | None = None,
        phone: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Create a dedicated virtual account for an existing customer

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            customer: Customer ID or code
            preferred_bank: The bank slug for a preferred bank. To get a list of available banks, use the
                Miscellaneous API ``.get_providers`` method.
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            first_name: Customer's first name
            last_name: Customer's last name
            phone: Customer's phone number
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account")
        payload = {
            "customer": customer,
        }
        optional_params = [
            ("preferred_bank", preferred_bank),
            ("subaccount", subaccount),
            ("split_code", split_code),
            ("first_name", first_name),
            ("last_name", last_name),
            ("phone", phone),
        ]
        payload = add_to_payload(optional_params, payload)
        return self._handle_request(
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    def assign(
        self,
        email: str,
        first_name: str,
        last_name: str,
        phone: str,
        preferred_bank: str,
        country: Country = Country.NIGERIA,
        account_number: str | None = None,
        bvn: str | None = None,
        bank_code: str | None = None,
        subaccount: str | None = None,
        split_code: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[None] | Response[PaystackDataModel]:
        """Create a customer, validate the customer, and assign a DVA to the customer.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            email: Customer email address
            first_name: Customer's first name
            last_name: Customer's last name
            phone: Customer's phone number
            preferred_bank: The bank slug for preferred bank. To get a list of available banks, use the
                Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks
                or AsyncMiscellaneous.get_banks, with `pay_with_bank_transfer=true`
            country: Currently accepts `Country.NIGERIA` only
            account_number: Customer's account number
            bvn: Customer's Bank Verification Number
            bank_code: Customer's bank code
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/assign")
        payload = {
            "email": email,
            "first_name": first_name,
            "last_name": last_name,
            "phone": phone,
            "preferred_bank": preferred_bank,
            "country": country,
        }
        optional_params = [
            ("account_number", account_number),
            ("bvn", bvn),
            ("bank_code", bank_code),
            ("subaccount", subaccount),
            ("split_code", split_code),
        ]
        payload = add_to_payload(optional_params, payload)
        return self._handle_request(  # type: ignore
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class,
        )

    def get_dedicated_accounts(
        self,
        active: bool = True,
        currency: Currency = Currency.NGN,
        provider_slug: str | None = None,
        bank_id: str | int | None = None,
        customer: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[list[DedicatedAccount]] | Response[PaystackDataModel]:
        """Fetches dedicated virtual accounts available on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            active: Status of the dedicated virtual account
            currency: The currency of the dedicated virtual account. Only ``Currency.NGN`` is currently allowed
            provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank. call the `.get_providers`
                method of this class to see available providers.
            bank_id: The bank's ID e.g., 035
            customer: The customer's ID
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        query_params = [
            ("currency", currency),
            ("provider_slug", provider_slug),
            ("bank_id", bank_id),
            ("customer", customer),
        ]
        url = self._full_url(f"/dedicated_account?active={active}")
        url = append_query_params(query_params, url)
        return self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    def get_dedicated_account(
        self,
        dedicated_account_id: int | str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Get details of a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            dedicated_account_id: ID of dedicated virtual account
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
        return self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    def requery(
        self,
        account_number: str,
        provider_slug: str,
        date: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[None] | Response[PaystackDataModel]:
        """Get details of a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            account_number: Virtual account number to requery
            provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank
            date: The day the transfer was made in YYYY-MM-DD ISO format
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account?account_number={account_number}")
        query_params = [
            ("provider_slug", provider_slug),
            ("date", date),
        ]
        url = append_query_params(query_params, url)
        return self._handle_request(  # type: ignore
            HTTPMethod.GET, url, response_data_model_class=alternate_model_class
        )

    def deactivate(
        self,
        dedicated_account_id: int | str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Deactivate a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            dedicated_account_id: ID of dedicated virtual account
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
        return self._handle_request(  # type: ignore
            HTTPMethod.DELETE, url, response_data_model_class=alternate_model_class
        )

    def split(
        self,
        customer: int | str,
        subaccount: str | None = None,
        split_code: str | None = None,
        preferred_bank: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Split a dedicated virtual account transaction with one or more accounts

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            customer: Customer ID or code
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            preferred_bank: The bank slug for a preferred bank. To get a list of available banks,
                use the Miscellaneous API ``.get_providers`` method
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/split")
        payload = {"customer": customer}

        optional_params = [
            ("subaccount", subaccount),
            ("split_code", split_code),
            ("preferred_bank", preferred_bank),
        ]
        payload = add_to_payload(optional_params, payload)
        return self._handle_request(  # type: ignore
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    def remove_split(
        self,
        account_number: str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Removes a split.

        If you've previously set up split payment for transactions on a dedicated virtual
        account, you can remove it with this method.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            account_number: Dedicated virtual account number
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/split")
        payload = {
            "account_number": account_number,
        }
        return self._handle_request(  # type: ignore
            HTTPMethod.DELETE,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    def get_providers(
        self,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]:
        """Get available bank providers for a dedicated virtual account

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/available_providers")
        return self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccountProvider,
        )

assign(email, first_name, last_name, phone, preferred_bank, country=Country.NIGERIA, account_number=None, bvn=None, bank_code=None, subaccount=None, split_code=None, alternate_model_class=None)

Create a customer, validate the customer, and assign a DVA to the customer.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
email str

Customer email address

required
first_name str

Customer's first name

required
last_name str

Customer's last name

required
phone str

Customer's phone number

required
preferred_bank str

The bank slug for preferred bank. To get a list of available banks, use the Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks or AsyncMiscellaneous.get_banks, with pay_with_bank_transfer=true

required
country Country

Currently accepts Country.NIGERIA only

NIGERIA
account_number str | None

Customer's account number

None
bvn str | None

Customer's Bank Verification Number

None
bank_code str | None

Customer's bank code

None
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[None] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def assign(
    self,
    email: str,
    first_name: str,
    last_name: str,
    phone: str,
    preferred_bank: str,
    country: Country = Country.NIGERIA,
    account_number: str | None = None,
    bvn: str | None = None,
    bank_code: str | None = None,
    subaccount: str | None = None,
    split_code: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[None] | Response[PaystackDataModel]:
    """Create a customer, validate the customer, and assign a DVA to the customer.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        email: Customer email address
        first_name: Customer's first name
        last_name: Customer's last name
        phone: Customer's phone number
        preferred_bank: The bank slug for preferred bank. To get a list of available banks, use the
            Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks
            or AsyncMiscellaneous.get_banks, with `pay_with_bank_transfer=true`
        country: Currently accepts `Country.NIGERIA` only
        account_number: Customer's account number
        bvn: Customer's Bank Verification Number
        bank_code: Customer's bank code
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/assign")
    payload = {
        "email": email,
        "first_name": first_name,
        "last_name": last_name,
        "phone": phone,
        "preferred_bank": preferred_bank,
        "country": country,
    }
    optional_params = [
        ("account_number", account_number),
        ("bvn", bvn),
        ("bank_code", bank_code),
        ("subaccount", subaccount),
        ("split_code", split_code),
    ]
    payload = add_to_payload(optional_params, payload)
    return self._handle_request(  # type: ignore
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class,
    )

create(customer, preferred_bank=None, subaccount=None, split_code=None, first_name=None, last_name=None, phone=None, alternate_model_class=None)

Create a dedicated virtual account for an existing customer

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
customer str

Customer ID or code

required
preferred_bank str | None

The bank slug for a preferred bank. To get a list of available banks, use the Miscellaneous API .get_providers method.

None
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
first_name str | None

Customer's first name

None
last_name str | None

Customer's last name

None
phone str | None

Customer's phone number

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def create(
    self,
    customer: str,
    preferred_bank: str | None = None,
    subaccount: str | None = None,
    split_code: str | None = None,
    first_name: str | None = None,
    last_name: str | None = None,
    phone: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Create a dedicated virtual account for an existing customer

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        customer: Customer ID or code
        preferred_bank: The bank slug for a preferred bank. To get a list of available banks, use the
            Miscellaneous API ``.get_providers`` method.
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        first_name: Customer's first name
        last_name: Customer's last name
        phone: Customer's phone number
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account")
    payload = {
        "customer": customer,
    }
    optional_params = [
        ("preferred_bank", preferred_bank),
        ("subaccount", subaccount),
        ("split_code", split_code),
        ("first_name", first_name),
        ("last_name", last_name),
        ("phone", phone),
    ]
    payload = add_to_payload(optional_params, payload)
    return self._handle_request(
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

deactivate(dedicated_account_id, alternate_model_class=None)

Deactivate a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
dedicated_account_id int | str

ID of dedicated virtual account

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def deactivate(
    self,
    dedicated_account_id: int | str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Deactivate a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        dedicated_account_id: ID of dedicated virtual account
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
    return self._handle_request(  # type: ignore
        HTTPMethod.DELETE, url, response_data_model_class=alternate_model_class
    )

get_dedicated_account(dedicated_account_id, alternate_model_class=None)

Get details of a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
dedicated_account_id int | str

ID of dedicated virtual account

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def get_dedicated_account(
    self,
    dedicated_account_id: int | str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Get details of a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        dedicated_account_id: ID of dedicated virtual account
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
    return self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

get_dedicated_accounts(active=True, currency=Currency.NGN, provider_slug=None, bank_id=None, customer=None, alternate_model_class=None)

Fetches dedicated virtual accounts available on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
active bool

Status of the dedicated virtual account

True
currency Currency

The currency of the dedicated virtual account. Only Currency.NGN is currently allowed

NGN
provider_slug str | None

The bank's slug in lowercase, without spaces e.g. wema-bank. call the .get_providers method of this class to see available providers.

None
bank_id str | int | None

The bank's ID e.g., 035

None
customer str | None

The customer's ID

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[list[DedicatedAccount]] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def get_dedicated_accounts(
    self,
    active: bool = True,
    currency: Currency = Currency.NGN,
    provider_slug: str | None = None,
    bank_id: str | int | None = None,
    customer: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[list[DedicatedAccount]] | Response[PaystackDataModel]:
    """Fetches dedicated virtual accounts available on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        active: Status of the dedicated virtual account
        currency: The currency of the dedicated virtual account. Only ``Currency.NGN`` is currently allowed
        provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank. call the `.get_providers`
            method of this class to see available providers.
        bank_id: The bank's ID e.g., 035
        customer: The customer's ID
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    query_params = [
        ("currency", currency),
        ("provider_slug", provider_slug),
        ("bank_id", bank_id),
        ("customer", customer),
    ]
    url = self._full_url(f"/dedicated_account?active={active}")
    url = append_query_params(query_params, url)
    return self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

get_providers(alternate_model_class=None)

Get available bank providers for a dedicated virtual account

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def get_providers(
    self,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]:
    """Get available bank providers for a dedicated virtual account

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/available_providers")
    return self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccountProvider,
    )

remove_split(account_number, alternate_model_class=None)

Removes a split.

If you've previously set up split payment for transactions on a dedicated virtual account, you can remove it with this method.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
account_number str

Dedicated virtual account number

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def remove_split(
    self,
    account_number: str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Removes a split.

    If you've previously set up split payment for transactions on a dedicated virtual
    account, you can remove it with this method.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        account_number: Dedicated virtual account number
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/split")
    payload = {
        "account_number": account_number,
    }
    return self._handle_request(  # type: ignore
        HTTPMethod.DELETE,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

requery(account_number, provider_slug, date=None, alternate_model_class=None)

Get details of a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
account_number str

Virtual account number to requery

required
provider_slug str

The bank's slug in lowercase, without spaces e.g. wema-bank

required
date str | None

The day the transfer was made in YYYY-MM-DD ISO format

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[None] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def requery(
    self,
    account_number: str,
    provider_slug: str,
    date: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[None] | Response[PaystackDataModel]:
    """Get details of a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        account_number: Virtual account number to requery
        provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank
        date: The day the transfer was made in YYYY-MM-DD ISO format
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account?account_number={account_number}")
    query_params = [
        ("provider_slug", provider_slug),
        ("date", date),
    ]
    url = append_query_params(query_params, url)
    return self._handle_request(  # type: ignore
        HTTPMethod.GET, url, response_data_model_class=alternate_model_class
    )

split(customer, subaccount=None, split_code=None, preferred_bank=None, alternate_model_class=None)

Split a dedicated virtual account transaction with one or more accounts

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
customer int | str

Customer ID or code

required
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
preferred_bank str | None

The bank slug for a preferred bank. To get a list of available banks, use the Miscellaneous API .get_providers method

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/sync_clients/dedicated_accounts.py
def split(
    self,
    customer: int | str,
    subaccount: str | None = None,
    split_code: str | None = None,
    preferred_bank: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Split a dedicated virtual account transaction with one or more accounts

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        customer: Customer ID or code
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        preferred_bank: The bank slug for a preferred bank. To get a list of available banks,
            use the Miscellaneous API ``.get_providers`` method
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/split")
    payload = {"customer": customer}

    optional_params = [
        ("subaccount", subaccount),
        ("split_code", split_code),
        ("preferred_bank", preferred_bank),
    ]
    payload = add_to_payload(optional_params, payload)
    return self._handle_request(  # type: ignore
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

AsyncDedicatedAccountClient

Bases: BaseAsyncAPIClient

Provides a wrapper for paystack Dedicated Virtual Account API

The Dedicated Virtual Account API enables Nigerian merchants to manage unique payment accounts of their customers. https://paystack.com/docs/api/dedicated-virtual-account/

Note

This feature is only available to businesses in Nigeria.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
class AsyncDedicatedAccountClient(BaseAsyncAPIClient):
    """Provides a wrapper for paystack Dedicated Virtual Account API

    The Dedicated Virtual Account API enables Nigerian merchants to manage
    unique payment accounts of their customers.
    https://paystack.com/docs/api/dedicated-virtual-account/


    Note:
        This feature is only available to businesses in Nigeria.
    """

    async def create(
        self,
        customer: str,
        preferred_bank: str | None = None,
        subaccount: str | None = None,
        split_code: str | None = None,
        first_name: str | None = None,
        last_name: str | None = None,
        phone: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Create a dedicated virtual account for an existing customer

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            customer: Customer ID or code
            preferred_bank: The bank slug for a preferred bank. To get a list of available banks, use the
                Miscellaneous API ``.get_providers`` method.
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            first_name: Customer's first name
            last_name: Customer's last name
            phone: Customer's phone number
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account")
        payload = {
            "customer": customer,
        }
        optional_params = [
            ("preferred_bank", preferred_bank),
            ("subaccount", subaccount),
            ("split_code", split_code),
            ("first_name", first_name),
            ("last_name", last_name),
            ("phone", phone),
        ]
        payload = add_to_payload(optional_params, payload)
        return await self._handle_request(  # type: ignore
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    async def assign(
        self,
        email: str,
        first_name: str,
        last_name: str,
        phone: str,
        preferred_bank: str,
        country: Country = Country.NIGERIA,
        account_number: str | None = None,
        bvn: str | None = None,
        bank_code: str | None = None,
        subaccount: str | None = None,
        split_code: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[None] | Response[PaystackDataModel]:
        """Create a customer, validate the customer, and assign a DVA to the customer.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            email: Customer email address
            first_name: Customer's first name
            last_name: Customer's last name
            phone: Customer's phone number
            preferred_bank: The bank slug for preferred bank. To get a list of available banks, use the
                Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks
                or AsyncMiscellaneous.get_banks, with `pay_with_bank_transfer=true`
            country: Currently accepts `Country.NIGERIA` only
            account_number: Customer's account number
            bvn: Customer's Bank Verification Number
            bank_code: Customer's bank code
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/assign")
        payload = {
            "email": email,
            "first_name": first_name,
            "last_name": last_name,
            "phone": phone,
            "preferred_bank": preferred_bank,
            "country": country,
        }
        optional_params = [
            ("account_number", account_number),
            ("bvn", bvn),
            ("bank_code", bank_code),
            ("subaccount", subaccount),
            ("split_code", split_code),
        ]
        payload = add_to_payload(optional_params, payload)
        return await self._handle_request(  # type: ignore
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class,
        )

    async def get_dedicated_accounts(
        self,
        active: bool = True,
        currency: Currency = Currency.NGN,
        provider_slug: str | None = None,
        bank_id: str | int | None = None,
        customer: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[list[DedicatedAccount]] | Response[PaystackDataModel]:
        """Fetches dedicated virtual accounts available on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            active: Status of the dedicated virtual account
            currency: The currency of the dedicated virtual account. Only ``Currency.NGN`` is currently allowed
            provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank. call the `.get_providers`
                method of this class to see available providers.
            bank_id: The bank's ID e.g., 035
            customer: The customer's ID
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        query_params = [
            ("currency", currency),
            ("provider_slug", provider_slug),
            ("bank_id", bank_id),
            ("customer", customer),
        ]
        url = self._full_url(f"/dedicated_account?active={active}")
        url = append_query_params(query_params, url)
        return await self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    async def get_dedicated_account(
        self,
        dedicated_account_id: int | str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Get details of a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            dedicated_account_id: ID of dedicated virtual account
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
        return await self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    async def requery(
        self,
        account_number: str,
        provider_slug: str,
        date: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[None] | Response[PaystackDataModel]:
        """Get details of a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Wema Bank and Titan Paystack.

        Args:
            account_number: Virtual account number to requery
            provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank
            date: The day the transfer was made in YYYY-MM-DD ISO format
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account?account_number={account_number}")
        query_params = [
            ("provider_slug", provider_slug),
            ("date", date),
        ]
        url = append_query_params(query_params, url)
        return await self._handle_request(  # type: ignore
            HTTPMethod.GET, url, response_data_model_class=alternate_model_class
        )

    async def deactivate(
        self,
        dedicated_account_id: int | str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Deactivate a dedicated virtual account on your integration.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            dedicated_account_id: ID of dedicated virtual account
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
        return await self._handle_request(  # type: ignore
            HTTPMethod.DELETE, url, response_data_model_class=alternate_model_class
        )

    async def split(
        self,
        customer: int | str,
        subaccount: str | None = None,
        split_code: str | None = None,
        preferred_bank: str | None = None,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Split a dedicated virtual account transaction with one or more accounts

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            customer: Customer ID or code
            subaccount: Subaccount code of the account you want to split the transaction with
            split_code: Split code consisting of the lists of accounts you want to split the transaction with
            preferred_bank: The bank slug for a preferred bank. To get a list of available banks,
                use the Miscellaneous API ``.get_providers`` method
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/split")
        payload = {"customer": customer}

        optional_params = [
            ("subaccount", subaccount),
            ("split_code", split_code),
            ("preferred_bank", preferred_bank),
        ]
        payload = add_to_payload(optional_params, payload)
        return await self._handle_request(  # type: ignore
            HTTPMethod.POST,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    async def remove_split(
        self,
        account_number: str,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
        """Removes a split.

        If you've previously set up split payment for transactions on a dedicated virtual
        account, you can remove it with this method.

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            account_number: Dedicated virtual account number
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/split")
        payload = {
            "account_number": account_number,
        }
        return await self._handle_request(  # type: ignore
            HTTPMethod.DELETE,
            url,
            payload,
            response_data_model_class=alternate_model_class or DedicatedAccount,
        )

    async def get_providers(
        self,
        alternate_model_class: type[PaystackDataModel] | None = None,
    ) -> Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]:
        """Get available bank providers for a dedicated virtual account

        Note:
            * This feature is only available to businesses in Nigeria.
            * Paystack currently supports Access Bank and Wema Bank.

        Args:
            alternate_model_class: A pydantic model class to use instead of the
                default pydantic model used by the library to present the data in
                the `Response.data`. The default behaviour of the library is to
                set  `Response.data` to `None` if it fails to serialize the data
                returned from paystack with the model provided in the library.
                Providing a pydantic model class via this parameter overrides
                the library default model with the model class you provide.
                This can come in handy when the models in the library do not
                accurately represent the data returned, and you prefer working with the
                data as a pydantic model instead of as a dict of the response returned
                by  paystack before it is serialized with pydantic models, The original
                data can be accessed via `Response.raw`.

        Returns:
            A pydantic model containing the response gotten from paystack's server.
        """

        url = self._full_url("/dedicated_account/available_providers")
        return await self._handle_request(  # type: ignore
            HTTPMethod.GET,
            url,
            response_data_model_class=alternate_model_class or DedicatedAccountProvider,
        )

assign(email, first_name, last_name, phone, preferred_bank, country=Country.NIGERIA, account_number=None, bvn=None, bank_code=None, subaccount=None, split_code=None, alternate_model_class=None) async

Create a customer, validate the customer, and assign a DVA to the customer.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
email str

Customer email address

required
first_name str

Customer's first name

required
last_name str

Customer's last name

required
phone str

Customer's phone number

required
preferred_bank str

The bank slug for preferred bank. To get a list of available banks, use the Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks or AsyncMiscellaneous.get_banks, with pay_with_bank_transfer=true

required
country Country

Currently accepts Country.NIGERIA only

NIGERIA
account_number str | None

Customer's account number

None
bvn str | None

Customer's Bank Verification Number

None
bank_code str | None

Customer's bank code

None
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[None] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def assign(
    self,
    email: str,
    first_name: str,
    last_name: str,
    phone: str,
    preferred_bank: str,
    country: Country = Country.NIGERIA,
    account_number: str | None = None,
    bvn: str | None = None,
    bank_code: str | None = None,
    subaccount: str | None = None,
    split_code: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[None] | Response[PaystackDataModel]:
    """Create a customer, validate the customer, and assign a DVA to the customer.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        email: Customer email address
        first_name: Customer's first name
        last_name: Customer's last name
        phone: Customer's phone number
        preferred_bank: The bank slug for preferred bank. To get a list of available banks, use the
            Paystack.miscellaneous.get_banks, AsyncPaystack.miscellaneous.get_banks, Miscellaneous.get_banks
            or AsyncMiscellaneous.get_banks, with `pay_with_bank_transfer=true`
        country: Currently accepts `Country.NIGERIA` only
        account_number: Customer's account number
        bvn: Customer's Bank Verification Number
        bank_code: Customer's bank code
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/assign")
    payload = {
        "email": email,
        "first_name": first_name,
        "last_name": last_name,
        "phone": phone,
        "preferred_bank": preferred_bank,
        "country": country,
    }
    optional_params = [
        ("account_number", account_number),
        ("bvn", bvn),
        ("bank_code", bank_code),
        ("subaccount", subaccount),
        ("split_code", split_code),
    ]
    payload = add_to_payload(optional_params, payload)
    return await self._handle_request(  # type: ignore
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class,
    )

create(customer, preferred_bank=None, subaccount=None, split_code=None, first_name=None, last_name=None, phone=None, alternate_model_class=None) async

Create a dedicated virtual account for an existing customer

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
customer str

Customer ID or code

required
preferred_bank str | None

The bank slug for a preferred bank. To get a list of available banks, use the Miscellaneous API .get_providers method.

None
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
first_name str | None

Customer's first name

None
last_name str | None

Customer's last name

None
phone str | None

Customer's phone number

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def create(
    self,
    customer: str,
    preferred_bank: str | None = None,
    subaccount: str | None = None,
    split_code: str | None = None,
    first_name: str | None = None,
    last_name: str | None = None,
    phone: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Create a dedicated virtual account for an existing customer

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        customer: Customer ID or code
        preferred_bank: The bank slug for a preferred bank. To get a list of available banks, use the
            Miscellaneous API ``.get_providers`` method.
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        first_name: Customer's first name
        last_name: Customer's last name
        phone: Customer's phone number
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account")
    payload = {
        "customer": customer,
    }
    optional_params = [
        ("preferred_bank", preferred_bank),
        ("subaccount", subaccount),
        ("split_code", split_code),
        ("first_name", first_name),
        ("last_name", last_name),
        ("phone", phone),
    ]
    payload = add_to_payload(optional_params, payload)
    return await self._handle_request(  # type: ignore
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

deactivate(dedicated_account_id, alternate_model_class=None) async

Deactivate a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
dedicated_account_id int | str

ID of dedicated virtual account

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def deactivate(
    self,
    dedicated_account_id: int | str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Deactivate a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        dedicated_account_id: ID of dedicated virtual account
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
    return await self._handle_request(  # type: ignore
        HTTPMethod.DELETE, url, response_data_model_class=alternate_model_class
    )

get_dedicated_account(dedicated_account_id, alternate_model_class=None) async

Get details of a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
dedicated_account_id int | str

ID of dedicated virtual account

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def get_dedicated_account(
    self,
    dedicated_account_id: int | str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Get details of a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        dedicated_account_id: ID of dedicated virtual account
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account/{dedicated_account_id}")
    return await self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

get_dedicated_accounts(active=True, currency=Currency.NGN, provider_slug=None, bank_id=None, customer=None, alternate_model_class=None) async

Fetches dedicated virtual accounts available on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
active bool

Status of the dedicated virtual account

True
currency Currency

The currency of the dedicated virtual account. Only Currency.NGN is currently allowed

NGN
provider_slug str | None

The bank's slug in lowercase, without spaces e.g. wema-bank. call the .get_providers method of this class to see available providers.

None
bank_id str | int | None

The bank's ID e.g., 035

None
customer str | None

The customer's ID

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[list[DedicatedAccount]] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def get_dedicated_accounts(
    self,
    active: bool = True,
    currency: Currency = Currency.NGN,
    provider_slug: str | None = None,
    bank_id: str | int | None = None,
    customer: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[list[DedicatedAccount]] | Response[PaystackDataModel]:
    """Fetches dedicated virtual accounts available on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        active: Status of the dedicated virtual account
        currency: The currency of the dedicated virtual account. Only ``Currency.NGN`` is currently allowed
        provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank. call the `.get_providers`
            method of this class to see available providers.
        bank_id: The bank's ID e.g., 035
        customer: The customer's ID
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    query_params = [
        ("currency", currency),
        ("provider_slug", provider_slug),
        ("bank_id", bank_id),
        ("customer", customer),
    ]
    url = self._full_url(f"/dedicated_account?active={active}")
    url = append_query_params(query_params, url)
    return await self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

get_providers(alternate_model_class=None) async

Get available bank providers for a dedicated virtual account

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def get_providers(
    self,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[list[DedicatedAccountProvider]] | Response[PaystackDataModel]:
    """Get available bank providers for a dedicated virtual account

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/available_providers")
    return await self._handle_request(  # type: ignore
        HTTPMethod.GET,
        url,
        response_data_model_class=alternate_model_class or DedicatedAccountProvider,
    )

remove_split(account_number, alternate_model_class=None) async

Removes a split.

If you've previously set up split payment for transactions on a dedicated virtual account, you can remove it with this method.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
account_number str

Dedicated virtual account number

required
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def remove_split(
    self,
    account_number: str,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Removes a split.

    If you've previously set up split payment for transactions on a dedicated virtual
    account, you can remove it with this method.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        account_number: Dedicated virtual account number
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/split")
    payload = {
        "account_number": account_number,
    }
    return await self._handle_request(  # type: ignore
        HTTPMethod.DELETE,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )

requery(account_number, provider_slug, date=None, alternate_model_class=None) async

Get details of a dedicated virtual account on your integration.

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Wema Bank and Titan Paystack.

Parameters:

Name Type Description Default
account_number str

Virtual account number to requery

required
provider_slug str

The bank's slug in lowercase, without spaces e.g. wema-bank

required
date str | None

The day the transfer was made in YYYY-MM-DD ISO format

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[None] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def requery(
    self,
    account_number: str,
    provider_slug: str,
    date: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[None] | Response[PaystackDataModel]:
    """Get details of a dedicated virtual account on your integration.

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Wema Bank and Titan Paystack.

    Args:
        account_number: Virtual account number to requery
        provider_slug: The bank's slug in lowercase, without spaces e.g. wema-bank
        date: The day the transfer was made in YYYY-MM-DD ISO format
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url(f"/dedicated_account?account_number={account_number}")
    query_params = [
        ("provider_slug", provider_slug),
        ("date", date),
    ]
    url = append_query_params(query_params, url)
    return await self._handle_request(  # type: ignore
        HTTPMethod.GET, url, response_data_model_class=alternate_model_class
    )

split(customer, subaccount=None, split_code=None, preferred_bank=None, alternate_model_class=None) async

Split a dedicated virtual account transaction with one or more accounts

Note
  • This feature is only available to businesses in Nigeria.
  • Paystack currently supports Access Bank and Wema Bank.

Parameters:

Name Type Description Default
customer int | str

Customer ID or code

required
subaccount str | None

Subaccount code of the account you want to split the transaction with

None
split_code str | None

Split code consisting of the lists of accounts you want to split the transaction with

None
preferred_bank str | None

The bank slug for a preferred bank. To get a list of available banks, use the Miscellaneous API .get_providers method

None
alternate_model_class type[PaystackDataModel] | None

A pydantic model class to use instead of the default pydantic model used by the library to present the data in the Response.data. The default behaviour of the library is to set Response.data to None if it fails to serialize the data returned from paystack with the model provided in the library. Providing a pydantic model class via this parameter overrides the library default model with the model class you provide. This can come in handy when the models in the library do not accurately represent the data returned, and you prefer working with the data as a pydantic model instead of as a dict of the response returned by paystack before it is serialized with pydantic models, The original data can be accessed via Response.raw.

None

Returns:

Type Description
Response[DedicatedAccount] | Response[PaystackDataModel]

A pydantic model containing the response gotten from paystack's server.

Source code in src/pypaystack2/sub_clients/async_clients/dedicated_accounts.py
async def split(
    self,
    customer: int | str,
    subaccount: str | None = None,
    split_code: str | None = None,
    preferred_bank: str | None = None,
    alternate_model_class: type[PaystackDataModel] | None = None,
) -> Response[DedicatedAccount] | Response[PaystackDataModel]:
    """Split a dedicated virtual account transaction with one or more accounts

    Note:
        * This feature is only available to businesses in Nigeria.
        * Paystack currently supports Access Bank and Wema Bank.

    Args:
        customer: Customer ID or code
        subaccount: Subaccount code of the account you want to split the transaction with
        split_code: Split code consisting of the lists of accounts you want to split the transaction with
        preferred_bank: The bank slug for a preferred bank. To get a list of available banks,
            use the Miscellaneous API ``.get_providers`` method
        alternate_model_class: A pydantic model class to use instead of the
            default pydantic model used by the library to present the data in
            the `Response.data`. The default behaviour of the library is to
            set  `Response.data` to `None` if it fails to serialize the data
            returned from paystack with the model provided in the library.
            Providing a pydantic model class via this parameter overrides
            the library default model with the model class you provide.
            This can come in handy when the models in the library do not
            accurately represent the data returned, and you prefer working with the
            data as a pydantic model instead of as a dict of the response returned
            by  paystack before it is serialized with pydantic models, The original
            data can be accessed via `Response.raw`.

    Returns:
        A pydantic model containing the response gotten from paystack's server.
    """

    url = self._full_url("/dedicated_account/split")
    payload = {"customer": customer}

    optional_params = [
        ("subaccount", subaccount),
        ("split_code", split_code),
        ("preferred_bank", preferred_bank),
    ]
    payload = add_to_payload(optional_params, payload)
    return await self._handle_request(  # type: ignore
        HTTPMethod.POST,
        url,
        payload,
        response_data_model_class=alternate_model_class or DedicatedAccount,
    )