Want to create new contract but getting error

i am creating contracts for payg_tasks because i want to pay only once and letter is user get referral earning my curl request is here getting lot of error please help to solve it

curl --location 'https://api-sandbox.demo.deel.com/rest/v2/contracts' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer {{TOKEN}}' \
--data-raw '{
    "data": {
        "country_code": "US",
        "external_id": "11001100110",
        "notice_period": 10,
        "scope_of_work": "Lorem ipsum dolor sit amet.",
        "special_clause": "Lorem ipsum dolor sit amet.",
        "start_date": "2024-08-01",
        "state_code": "IL",
        "termination_date": "2024-08-31",
        "title": "Contract",
        "type": "payg_tasks",
        "client": {
            "legal_entity": {
                "id": "00000000-0000-0000-0000-000000000000"
            },
            "team": {
                "id": "00000000-0000-0000-0000-000000000000"
            }
        },
        "worker": {
            "expected_email": "demo@email.com",
            "first_name": "John",
            "last_name": "Doe"
        },
        "job_title": {
            "id": "12345"
        },
        "seniority": {
            "id": "12345"
        },
        "meta": {
            "documents_required": true
        },
        "compensation_details": {
            "currency_code": "USD",
            "cycle_end": 30,
            "amount":450,
            "cycle_end_type": "DAY_OF_MONTH",
            "first_payment": 0,
            "first_payment_date": "2024-09-05",
            "frequency": "weekly",
            "notice_period": 0,
            "scale":"",
            "pay_before_weekends": true,
            "payment_due_days": 5,
            "payment_due_type": "REGULAR"
        }
    }
}'

thanks in advance

@jaydip can you share the error message?

Message is something went wrong

I have pass all data as per request example in document

That’s a generic error message. There should be more info about the error

see there is no proper error can you please try to use above curl and call api from postman you will get better idea of issue please

Thanks for helping

Oooof this is error 500. It means something is wrong on their side. I tried using another type and it shows a proper error message like this

You just need to wait for their official support.

yeh oky Thanks for your help

@jaydip From the logs, seems like you are sending incorrect input.

cycle_end_type must be DAY_OF_WEEK for weekly frequency. Also I see you are sending 00000000-0000-0000-0000-000000000000 for some Ids.

Can you please check req body and try again.

Thanks

yeh i try to change DAY_OF_WEEK but still it’s 500

“client”: {
“legal_entity”: {
“id”: “00000000-0000-0000-0000-000000000000”
},
“team”: {
“id”: “00000000-0000-0000-0000-000000000000”
}
},

i am using sandbox what is the value for this or from where i get this can you please help

Thanks again for your help @Anees_Deel

These IDs are specific to your account, please use below Eps to fetch the same:
Get teams - Get Team List
Get legal entities - List of legal entities

  • compensation_details.cycle_end //Cycle end must be between 1 and 7 for weekly cycle scale
  • compensation_details.scale //must be one of [hourly, daily, weekly, monthly, biweekly, semimonthly, custom, null]

Thanks

Thanks @Anees_Deel
i have one doubt

Like i am using Deel payment for send referral earnings to users for app
i don’t have specific day fix for payment like weekly or monthly

like if user has some x amount of referral earnings and if user create withdrawal request i will approve it from my admin ,so once i approve it i should send payment from Deel(what api flow should i flow for this)

so what exactly Api flow i need to follow for my above logic please help me because i am getting difficulty to understood this api flow for my logic

Thank you so much once again @Anees_Deel @brijumaquio

In my screenshot, I supplied a valid ids for team and legal_entity and got the same generic error message.

  • compensation_details.scale //must be one of [hourly, daily, weekly, monthly, biweekly, semimonthly, custom, null]

The compensation_details.scale property is only required for pay_as_you_go_time_based and not for payg_tasks

@brijumaquio can you help with my flow which i above ask to @Anees_Deel please

Thanks in advance

Hey @Anees_Deel can you please help i am totally stuck with flow so please

@jaydip Apologies for the delay, we do not support approval of payments via API as of now.

No worries
for example user jai has 50$ referrals earnings ,now if i need to sent that payment via deel
so i am following this API flow

-first need to create contractor (which type of contractor should i create, also it asking frequency but i need to paid once and latter when user jai has enough amount to payment)
i am using API:- https://api.letsdeel.com/rest/v2/contracts

-then i need to pay using this API :- https://api.letsdeel.com/rest/v2/contracts/{contract_id}/tasks

that’s it? or i am miss any API? or following wrong flow?

Please let me know @Anees_Deel

Thanks a lot for your response

Hi Jaydip,

How are you doing? I’m Stefano and I’m a technical writer at Deel.

From the flow you described, I believe that the following documentation could be of help:

Managing task-based contractors

Let me know if it covers the flow you are trying to go through.

Hey @Stefano_Deel Thank you so much for your response

i am using sandbox and try to create new contract but getting error 500:Something went wrong

here is my payload can you please guide me

{
    "data": {
        "country_code": "US",
        "external_id": "11001100110",
        "start_date": "2024-12-19",
        "title": "Contract",
        "type": "payg_tasks",
        "client": {
            "legal_entity": { //use api  Get v2/legal-entities?country=US
                "id": "13ac182d-9acc-4b17-9dd8-36c6fb54b3f5"
            },
            "team": {//use api  Get v2/teams
                "id": "0eba8f5d-7999-4bb4-b95e-7a887f6d8961"
            }
        },
        "worker": {
            "expected_email": "demo@email.com",
            "first_name": "John"
        },
        "job_title": {
            "id":1 //use api  Get v2/lookups/job-titles
        },
        "seniority": {
            "id": 1 //use api  Get v2/lookups/seniorities
        },
        "meta": {
            "documents_required": true
        },
        "compensation_details": {
            "currency_code": "USD",
            "cycle_end": 30,
            "cycle_end_type": "DAY_OF_WEEK",
            "frequency": "weekly",
            "pay_before_weekends": true,
            "payment_due_days": 5,
            "payment_due_type": "REGULAR"
        }
    }
}

@Anees_Deel please help you can Thanks in advance

Hi @jaydip, can you share the request_id you got in response headers please so I can investigate the request logs?