import { API_ROOT } from 'config' import { callApi } from 'helpers' import { handleUnsuccessfulSubscription } from './buySubscription/handleUnsuccessfulSubscription' export type Props = { cardId: string, order: { background_music: string | null, duration: number, lang: string, matches: Array, player_id: number, price: number, sport_id: number, stats: boolean, }, } export const onePayment = async ({ cardId, order, }: Props) => { const config = { body: { action: 'one_payment', data: { card_id: cardId, item: { currency_iso: 'USD', order, price: order.price, }, type: 'highlights', }, service: 'stripe_ott', }, } return callApi({ config, url: `${API_ROOT}/account/payments`, }).catch(handleUnsuccessfulSubscription) }