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

    //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%2Fparameter=value%26parameter2=value";
    //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" />
  <input type="text" name="signup[customer][first_name]" /></br>
  <input type="text" name="signup[customer][last_name]" /></br>
  <input type="text" name="signup[customer][email]" /></br>
  <input type="text" name="signup[customer][organization]" /></br>
  <input type="text" name="signup[payment_profile][first_name]" /></br>
  <input type="text" name="signup[payment_profile][last_name]" /></br>
  <input type="text" name="signup[customer][reference]" /></br>

  <!-- begin credit card fields -->
 <input type="text" name="signup[payment_profile][card_number]" /></br>
 <input type="text" name="signup[payment_profile][expiration_month]" /></br>
 <input type="text" name="signup[payment_profile][expiration_year]" /></br>
 <input type="text" name="signup[coupon_code]" value="" /></br>
 <input type="text" name="signup[metafields][Individuals]" />
 <input type="text" name="signup[customer][phone]" />
  <!-- end credit card fields -->

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

As a guide, in chronological order, here are the fields used in the form above:

  • First name
  • Last name
  • Email
  • Organization
  • Billing first
  • Billing last
  • REF

  • Credit card number
  • Expiration month
  • Expiration year
  • Coupon
  • Metafield (optional custom field)
  • Phone