# ArgumentDecoder error:

**URL:** <https://forum.dfinity.org/t/argumentdecoder-error/21133>\
**Category:** Developers\
**Tags:** candid\
**Created:** [July 3, 2023, 3:18am UTC](https://forum.dfinity.org/t/argumentdecoder-error/21133 "2023-07-03T03:18:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pramitgaha](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/pramitgaha/32/11659_2.png) [@pramitgaha](https://forum.dfinity.org/u/pramitgaha)\
**Post date:** [July 3, 2023, 3:18am UTC](https://forum.dfinity.org/t/argumentdecoder-error/21133/1 "2023-07-03T03:18:11Z")

</div>

```rs
#[derive(CandidType, Serialize, Deserialize)]
pub struct Sender {
    pub name: String,
    pub country: String,
    pub phone: String,
    pub address: String,
    pub dob: String,
    pub email: String,
    pub idNumber: String,
    pub idType: String,
}

#[derive(CandidType, Serialize, Deserialize)]
pub struct Destination {
    pub accountName: String,
    pub accountNumber: String,
    pub accountType: String,
    pub networkId: String,
}

#[derive(CandidType, Serialize, Deserialize)]
pub struct SubmitPaymentRequestResponse {
    pub id: String,
    pub channelId: String,
    pub sequenceId: String,
    pub currency: String,
    pub country: String,
    pub amount: u128,
    pub reason: String,
    pub convertedAmount: u128,
    pub status: String,
    pub rate: u128,
    pub sender: Sender,
    pub destination: Destination,
    pub createdAt: String,
    pub updatedAt: String,
    pub expiresAt: String,
}

#[update]
#[candid_method(update)]
pub async fn submit_payment_request(
    authkey: String,
    timestamp: u64,
    channel_id: String,
    sequence_id: String,
    amount: u128,
    local_amount: u128,
    reason: String,
    sender_name: String,
    sender_country: String,
    sender_phone: String,
    sender_address: String,
    sender_dob: String,
    sender_email: String,
    sender_idNumber: String,
    sender_idType: String,
    destination_accountName: String,
    destination_accountNumber: String,
    destination_accountType: String,
    destination_networkId: String
) -> Result<SubmitPaymentRequestResponse, String> {
    let url = format!("https://sandbox.api.yellowcard.io/business/payments");
    let headers = vec![
        HttpHeader {
            name: "Authorization".into(),
            value: authkey,
        },
        HttpHeader {
            name: "X-YC-Timestamp".into(),
            value: format!("{}", timestamp),
        },
        HttpHeader {
            name: "accept".into(),
            value: "application/json".into(),
        },
    ];
    let data = serde_json::json!({
        "sender": {
            "name": sender_name,
            "country": sender_country,
            "phone":sender_phone,
            "address": sender_address,
            "dob": sender_dob,
            "email": sender_email,
            "idNumber": sender_idNumber,
            "idType": sender_idType
        },
        "destination": {
            "accountName": destination_accountName,
            "accountNumber": destination_accountNumber,
            "accountType": destination_accountType,
            "networkId": destination_networkId
        },
        "channelId": channel_id,
        "sequenceId": sequence_id,
        "amount": amount,
        "localAmount": local_amount,
        "reason": reason
    });
    let req_body = Some(data.to_string().into_bytes());
    let arg = CanisterHttpRequestArgument{
        url,
        max_response_bytes: None,
        method: HttpMethod::POST,
        headers,
        body: req_body,
        transform: Some(TransformContext {
            function: TransformFunc(candid::Func {
                method: "query".into(),
                principal: ic_cdk::id(),
            }),
            context: vec![],
        }),
    };
    match http_request(arg, 20_000_000_000).await{
        Err((rejection_code, msg)) => Err(format!(
            "Rejection code: {:?}, msg: {}",
            rejection_code, msg
        )),
        Ok((response,)) if response.status != Nat::from(200) => {
            let error_msg = String::from_utf8(response.body).map_err(|e| e.to_string())?;
            Err(error_msg)
        }
        Ok((response,)) => {
            let response: SubmitPaymentRequestResponse =
                serde_json::from_slice(&response.body).map_err(|e| e.to_string())?;
            Ok(response)
        }
    }
}

```

error:

```auto
error[E0277]: the trait bound `for<'a> (_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _): ArgumentDecoder<'a>` is not satisfied
   --> src/database/src/yellow_card_api/payment_apis.rs:64:1
    |
64 | #[update]
    | ^^^^^^^^^ the trait `for<'a> ArgumentDecoder<'a>` is not implemented for `(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _)`
    |
    = help: the following other types implement trait `ArgumentDecoder<'a>`:
              ()
              (A, B)
              (A, B, C)
              (A, B, C, D)
              (A, B, C, D, E)
              (A, B, C, D, E, F)
              (A, B, C, D, E, F, G)
              (A, B, C, D, E, F, G, H)
            and 9 others
note: required by a bound in `arg_data`
   --> /Users/pramitgaha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-cdk-0.9.2/src/api/call.rs:551:20
    |
551 | pub fn arg_data<R: for<'a> ArgumentDecoder<'a>>() -> R {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `arg_data`
    = note: this error originates in the attribute macro `update` (in Nightly builds, run with -Z macro-backtrace for more info)

```

---

<div class="post-metadata">

**Author:** ![pramitgaha](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/pramitgaha/32/11659_2.png) [@pramitgaha](https://forum.dfinity.org/u/pramitgaha)\
**Post date:** [July 3, 2023, 3:19am UTC](https://forum.dfinity.org/t/argumentdecoder-error/21133/2 "2023-07-03T03:19:52Z")

</div>

can someone point out, which point is throwing out error??

---

<div class="post-metadata">

**Author:** ![pramitgaha](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/pramitgaha/32/11659_2.png) [@pramitgaha](https://forum.dfinity.org/u/pramitgaha)\
**Post date:** [July 3, 2023, 3:23am UTC](https://forum.dfinity.org/t/argumentdecoder-error/21133/3 "2023-07-03T03:23:25Z")

</div>

so the error was generated due to the numbers of argument it was accepting.  
wrapping all the arguments in a struct, solved the issue.
