As recommended by USCIS, you should pay your USCIS Immigrant Fee after you receive your immigrant visa from the U.S. Department of States. But make sure that you pay the immigrant fee before you depart for the U.S.
If you do not pay the immigrant fee before you arrive to the U.S., USCIS will not issue a Permanent Resident Card in your name. You must immediately pay the immigrant fee right after your arrival to the U.S. If you cannot pay the fee, ask your sponsor (the Form I-130 petitioner), friend, or relative to pay for you.