You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
spa_instat_tv/src/requests/onePayment.tsx

44 lines
884 B

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<number>,
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)
}