API Reference

Payment Methods

Here are examples for working with the Payment Methods collection through the REST API.

Getting Payment Methods

Get User Payment Methods

const getUserPaymentMethods = async (token, userId) => {
  const response = await fetch(
    `https://api.picoshealth.com/v1/payment-methods?where={"user":{"equals":"${userId}"}}`,
    {
      headers: { 'Authorization': `Bearer ${token}` },
    }
  );
  return response.json();
};

Adding Payment Methods

const addPaymentMethod = async (token, userId) => {
  const response = await fetch('https://api.picoshealth.com/v1/payment-methods', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      user: userId,
      type: 'credit_card',
      last4: '4242',
      expiryDate: '12/2025',
      isDefault: false,
    }),
  });
  return response.json();
};

Updating Payment Methods

Set Default Payment Method

const setDefaultPaymentMethod = async (token, paymentMethodId) => {
  const response = await fetch(
    `https://api.picoshealth.com/v1/payment-methods/${paymentMethodId}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        isDefault: true,
      }),
    }
  );
  return response.json();
};

Deleting Payment Methods

const deletePaymentMethod = async (token, paymentMethodId) => {
  const response = await fetch(
    `https://api.picoshealth.com/v1/payment-methods/${paymentMethodId}`,
    {
      method: 'DELETE',
      headers: { 'Authorization': `Bearer ${token}` },
    }
  );
  return response;
};

Last Updated: June 22, 2026

Previous
Transactions