Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
</head>
<body>
<form method="post" action="https://api.chargify.com/api/v2/signups">

  <?php
    //Chargify Direct Credentials
    $api_secret = "chargify-direct-api-secret-key";
    $api_id = "chargify-direct-api-key";
    
    //Establish nonce through a timestamp
    $time = time();
    $nonce = md5($time);

    //Define your redirect URL
    $data = "redirect_uri=http%3A%2F%2Fwww.example.com";

    //Create concatenated string of API ID, time, nonce, and data
    $str = $api_id.$time.$nonce.$data;
    
    //Create Chargify Direct Signature
    $signature = hash_hmac( 'sha1', $str, $api_secret);
  ?>

  <!-- Define hidden form values using the values from above -->
  <input type="hidden" name="secure[api_id]"    value="<?php echo $api_id; ?>" />
  <input type="hidden" name="secure[timestamp]" value="<?php echo $time; ?>" />
  <input type="hidden" name="secure[nonce]"     value="<?php echo $nonce; ?>" />
  <input type="hidden" name="secure[data]"      value="<?php echo $data; ?>" />
  <input type="hidden" name="secure[signature]" value="<?php echo $signature; ?>" />

  <!-- For brevity, this form contains no labels, only inputs -->
  <input type="hidden" name="signup[product][handle]" value="example-product" />
  First Name <input type="text" name="signup[customer][first_name]" /></br>
  Last Name <input type="text" name="signup[customer][last_name]" /></br>
  Email <input type="text" name="signup[customer][email]" /></br>
  Organization <input type="text" name="signup[customer][organization]" /></br>
  Billing First <input type="text" name="signup[payment_profile][first_name]" /></br>
  Billing Last <input type="text" name="signup[payment_profile][last_name]" /></br>
  REF <input type="text" name="signup[customer][reference]" /></br>

  <!-- begin credit card fields -->
  CC # <input type="text" name="signup[payment_profile][card_number]" /></br>
  Exp month<input type="text" name="signup[payment_profile][expiration_month]" /></br>
  Exp yr<input type="text" name="signup[payment_profile][expiration_year]" /></br>
  Coupon <input type="text" name="signup[coupon_code]" /></br>
  Metafield (optional custom field): <input type="text" name="signup[metafields][Individuals]" />
  phone: <input type="text" name="signup[customer][phone]" />
  <!-- end credit card fields -->


  <input type="submit" value="Subscribe using Chargify Direct" />
</form>
</body>
</html>