Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
Last active January 6, 2018 13:49
Show Gist options
  • Select an option

  • Save polevaultweb/a7e09aa7d5331ac1e3af to your computer and use it in GitHub Desktop.

Select an option

Save polevaultweb/a7e09aa7d5331ac1e3af to your computer and use it in GitHub Desktop.
Activate Sellwire License
<?php
$sellwire_url = 'https://app.sellwire.net/api/1/';
$api_params = array(
'license' => $license,
'file' => $file_id
);
$response = wp_remote_get( add_query_arg( $api_params, $sellwire_url . 'activate_license' ), $this->license_args() );
if ( is_wp_error( $response ) ) {
$ajax_response['error'] = true;
$ajax_response['message'] = $response->get_error_message();
} else {
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
if ( isset( $license_data->license ) ) {
$options['license-status'] = $license_data->license;
$ajax_response['license_status'] = $license_data->license;
} else {
if ( isset( $license_data->error ) ) {
$ajax_response['error'] = true;
$ajax_response['message'] = $license_data->error;
}
}
}
update_option( 'your_settings', $options );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment