Skip to main content

Addresses

Methods to interact with recharge addresses.

listAddresses v1.0.0 read customers Types

Get a paginated list of addresses.

import { listAddresses } from '@rechargeapps/storefront-client';
await listAddresses(session, {
limit: 25,
sort_by: 'id-asc',
});

getAddress v1.0.0 read customers Types

Get a single address.

import { getAddress } from '@rechargeapps/storefront-client';
await getAddress(session, 123);

createAddress v1.0.0 write customers Types

Creates an address for a customer.

import { createAddress } from '@rechargeapps/storefront-client';
await createAddress(session, {
customer_id: 123,
address1: 'Dummy Address',
city: 'Omaha',
country_code: 'US',
first_name: 'Test',
last_name: 'Address',
phone: '123456789',
province: 'Nebraska',
zip: '68144',
});

updateAddress v1.0.0 write customers Types

Updates an address.

import { updateAddress } from '@rechargeapps/storefront-client';
await updateAddress(session, 123, {
address1: 'A new street',
});

applyDiscountToAddress v1.0.0 write customers Types

Applies a discount code to an address.

import { applyDiscountToAddress } from '@rechargeapps/storefront-client';
await applyDiscountToAddress(session, 123, 'discount_code');

removeDiscountsFromAddress v1.0.0 write customers Types

Removes all discounts from an address.

import { removeDiscountsFromAddress } from '@rechargeapps/storefront-client';
await removeDiscountsFromAddress(session, 123);

deleteAddress v1.0.0 write customers Types

Delete an address.

import { deleteAddress } from '@rechargeapps/storefront-client';
await deleteAddress(session, 123);

mergeAddresses v1.0.0 write customers Types

Merge up to 9 source addresses into a target address.

import { mergeAddresses } from '@rechargeapps/storefront-client';
await mergeAddresses(session, {
target_address: { id: 123 },
source_addresses: [{ id: 456 }, { id: 789 }],
});