Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [Cryptopay] fix amount to its currency base unit (#2049)

Prasunna Soppad3f18584f8e8
diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rs
index 040e68a66e..37c8f3f07a 100644
--- a/crates/router/src/connector/cryptopay/transformers.rs
+++ b/crates/router/src/connector/cryptopay/transformers.rs
@@ -3,7 +3,7 @@ use reqwest::Url;
use serde::{Deserialize, Serialize};
use crate::{
- connector::utils::CryptoData,
+ connector::utils::{self, CryptoData},
core::errors,
services,
types::{self, api, storage::enums},
@@ -11,7 +11,7 @@ use crate::{
#[derive(Default, Debug, Serialize)]
pub struct CryptopayPaymentsRequest {
- price_amount: i64,
+ price_amount: String,
price_currency: enums::Currency,
pay_currency: String,
success_redirect_url: Option<String>,
@@ -25,7 +25,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for CryptopayPaymentsRequest {
api::PaymentMethodData::Crypto(ref cryptodata) => {
let pay_currency = cryptodata.get_pay_currency()?;
Ok(Self {
- price_amount: item.request.amount,
+ price_amount: utils::to_currency_base_unit(
+ item.request.amount,
+ item.request.currency,
+ )?,
price_currency: item.request.currency,
pay_currency,
success_redirect_url: item.clone().request.router_return_url,