Addresses
Methods to interact with recharge addresses.
listAddresses v1.0.0 read customers Types
Get a paginated list of addresses.
- ESM
- UMD
import { listAddresses } from '@rechargeapps/storefront-client';
await listAddresses(session, {
limit: 25,
sort_by: 'id-asc',
});
await recharge.address.listAddresses(session, {
limit: 25,
sort_by: 'id-asc',
});
getAddress v1.0.0 read customers Types
Get a single address.
- ESM
- UMD
import { getAddress } from '@rechargeapps/storefront-client';
await getAddress(session, 123);
await recharge.address.getAddress(session, 123);
createAddress v1.0.0 write customers Types
Creates an address for a customer.
- ESM
- UMD
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',
});
await recharge.address.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.
- ESM
- UMD
import { updateAddress } from '@rechargeapps/storefront-client';
await updateAddress(session, 123, {
address1: 'A new street',
});
await recharge.address.updateAddress(session, 123, {
address1: 'A new street',
});
applyDiscountToAddress v1.0.0 write customers Types
Applies a discount code to an address.
- ESM
- UMD
import { applyDiscountToAddress } from '@rechargeapps/storefront-client';
await applyDiscountToAddress(session, 123, 'discount_code');
await recharge.address.applyDiscountToAddress(session, 123, 'discount_code');
removeDiscountsFromAddress v1.0.0 write customers Types
Removes all discounts from an address.
- ESM
- UMD
import { removeDiscountsFromAddress } from '@rechargeapps/storefront-client';
await removeDiscountsFromAddress(session, 123);
await recharge.address.removeDiscountsFromAddress(session, 123);
deleteAddress v1.0.0 write customers Types
Delete an address.
- ESM
- UMD
import { deleteAddress } from '@rechargeapps/storefront-client';
await deleteAddress(session, 123);
await recharge.address.deleteAddress(session, 123);
mergeAddresses v1.0.0 write customers Types
Merge up to 9 source addresses into a target address.
- ESM
- UMD
import { mergeAddresses } from '@rechargeapps/storefront-client';
await mergeAddresses(session, {
target_address: { id: 123 },
source_addresses: [{ id: 456 }, { id: 789 }],
});
await recharge.address.mergeAddresses(session, {
target_address: { id: 123 },
source_addresses: [{ id: 456 }, { id: 789 }],
});