Updated the payment integration to be dynamic
This commit is contained in:
@@ -40,7 +40,7 @@ export default function PaymobPayment({user, price, setIsPaymentLoading, currenc
|
|||||||
amount: price * 1000,
|
amount: price * 1000,
|
||||||
currency: "OMR",
|
currency: "OMR",
|
||||||
items: [],
|
items: [],
|
||||||
payment_methods: [1540],
|
payment_methods: [],
|
||||||
customer: {
|
customer: {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
first_name: user.name.split(" ")[0],
|
first_name: user.name.split(" ")[0],
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
|
|
||||||
const response = await axios.post<IntentionResult>(
|
const response = await axios.post<IntentionResult>(
|
||||||
"https://oman.paymob.com/v1/intention/",
|
"https://oman.paymob.com/v1/intention/",
|
||||||
{...intention, payment_methods: [1540], items: []},
|
{...intention, payment_methods: [parseInt(process.env.PAYMOB_INTEGRATION_ID || "0")], items: []},
|
||||||
{headers: {Authorization: `Token ${process.env.PAYMOB_SECRET_KEY}`}},
|
{headers: {Authorization: `Token ${process.env.PAYMOB_SECRET_KEY}`}},
|
||||||
);
|
);
|
||||||
const intentionResult = response.data;
|
const intentionResult = response.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user