Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AwadGorg's avatar

Sending data using curl

Hello, I want to send my user's data to tappayment to verify them and make them accounts at tappayment and tappayment provided me with a document on how to do so, and in the document, they ask me to send user data using curl

For each document, you need to make a \files request. You will receive a file_id for
each file you upload, you need to use it in creating a business.
Create a File
curl --location --request POST 'https://api.tap.company/v2/files' \
--header 'Authorization: Bearer sk_teqAcdQztv84agVkCBZEup0Hh' \
--header 'Content-Type: multipart/form-data' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form 'file=""' \
--form 'purpose="identity_document"' \
--form 'title="Commercial License "' \
--form 'expires_at="1913743462"' \
--form 'file_link_create="true"'

and this is the code am using to send the data

$teacher_data = array(
            'purpose' => 'identity_document',
            'file' => '',
            'title' => 'Commercial License ',
            'expires_at' => '1913743462',
            'file_link_create' => 'true'
        );
        $authorization = array(
            'Authorization: Bearer sk_live_k2fxIFGy8KYBWEhV0D97', // test : sk_test_GQJsuwnh5lqcikIrg6tO ,  live : sk_live_kmPRC2fxIFGy8KYBWEhV0D97
            // 'Content-Type: multipart/form-data',
            'Content-Type: application/json; multipart/form-data; boundary=---011000010111000001101001',
        );
$curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => "https://api.tap.company/v2/files",
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $teacher_data,
            CURLOPT_HTTPHEADER => $authorization,
        ));

        $response = curl_exec($curl);
        return $response;

and this is the response am getting

{"errors":[{"code":"10000","description":"file param required"},{"code":"10001","description":"purpose param required"},{"code":"10002","description":"file link data create param required"}],"timestamp":1663571602}

it says all the fields are required and I already sent them with $teacher_data var

0 likes
1 reply
wulfheart's avatar

Do you have access to the API? Can you debug it? Did you try to send it manually with curl or Postman?

Please or to participate in this conversation.