Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @gabriel

    I solved my previous post problem now I have this problem :

    I can ‘DEBIT’ my points but I can not ‘CREDIT’ and ‘PAY’ my points , here is the codes : (AMOUNT CAN DEDUCT BUT NOT CREDIT )
    *********************************************
    DEBIT : (WORK WELL)
    *********************************************
    $secret_key = ‘MY SECRET KEY’;
    $remote_url = ‘http://www.SITEREMOTE.com/api/’;

    $action = ‘CREDIT’;
    $account = ‘USER@yahoo.com’;
    $amount = 3;
    $ref = ‘reference’;
    $point_type = ‘mycred_default’;
    $ref_id = 0;
    $entry = ‘Payment for test’;
    $data = ‘optional extra’;
    $host = get_bloginfo( ‘url’ );

    $token = md5( $host . $action . $amount . $secret_key );

    $request = array(
    ‘method’ => ‘POST’,
    ‘body’ => array(
    ‘action’ => $action,
    ‘account’ => $account,
    ‘amount’ => $amount,
    ‘ref’ => $ref,
    ‘ref_id’ => $ref_id,
    ‘type’ => $point_type,
    ‘entry’ => $entry,
    ‘data’ => $data,
    ‘token’ => $token,
    ‘host’ => $host
    )
    );

    $response = wp_remote_post( $remote_url, $request );

    *********************************************
    CREDIT : (THE AMOUNT WILL NOT CREDIT TO THE USER)
    *********************************************
    $secret_key = ‘MY SECRET KEY’;
    $remote_url = ‘http://www.SITEREMOTE.com/api/’;

    $action = ‘CREDIT’;
    $account = ‘USER@yahoo.com’;
    $amount = 3;
    $ref = ‘reference’;
    $point_type = ‘mycred_default’;
    $ref_id = 0;
    $entry = ‘Payment for test’;
    $data = ‘optional extra’;
    $host = get_bloginfo( ‘url’ );

    $token = md5( $host . $action . $amount . $secret_key );

    $request = array(
    ‘method’ => ‘POST’,
    ‘body’ => array(
    ‘action’ => $action,
    ‘account’ => $account,
    ‘amount’ => $amount,
    ‘ref’ => $ref,
    ‘ref_id’ => $ref_id,
    ‘type’ => $point_type,
    ‘entry’ => $entry,
    ‘data’ => $data,
    ‘token’ => $token,
    ‘host’ => $host
    )
    );

    $response = wp_remote_post( $remote_url, $request );

    *********************************************
    PAY :
    here amount will deduct from the ‘USER’ but not credit to the ‘USER2’
    *********************************************
    $secret_key = ‘MY SECRET KEY’;
    $remote_url = ‘http://www.SITEREMOTE.com/api/’;

    $action = ‘PAY’;
    $account = ‘USER@yahoo.com’;
    $amount = 7;
    $to = ‘USER2@YAHOO.com’;
    $ref = ‘reference’;
    $ref_id = 0;
    $entry = ‘Payment for order #1234’;
    $data = ‘optional extra’;
    $point_type = ‘mycred_default’;
    $host = get_bloginfo( ‘url’ );

    $token = md5( $host . $action . $amount . $from . $to . $secret_key );

    $request = array(
    ‘method’ => ‘POST’,
    ‘body’ => array(
    ‘action’ => $action,
    ‘account’ => $from,
    ‘amount’ => $amount,
    ‘to’ => $to,
    ‘ref’ => $ref,
    ‘ref_id’ => $ref_id,
    ‘type’ => $point_type,
    ‘entry’ => $entry,
    ‘data’ => $data,
    ‘token’ => $token,
    ‘host’ => $host
    )
    );

    $response = wp_remote_post( $remote_url, $request );

    Dear Gabriel I am waiting for your answer ,
    Regards

    @gabriel

    I used this to deduct points but fails . would you please check it ?

    [insert_php]

    $secret_key = ‘secret key ‘;
    $remote_url = ‘site B’;
    $action = ‘CREDIT’;
    $account = ‘myemail@yahoo.com’;
    $host = get_bloginfo( ‘url’ );
    $amount = 10;
    $ref = ‘reference’;
    $point_type = ‘mycred_default’;
    $ref_id = 0;
    $entry = ‘Payment for test’;
    $data = ‘optional extra’;

    $token = md5( $host . $action . $amount . $secret_key );

    $request = array(
    ‘method’ => ‘POST’,
    ‘body’ => array(
    ‘action’ => $action,
    ‘account’ => $account,
    ‘amount’ => $amount,
    ‘ref’ => $ref,
    ‘ref_id’ => $ref_id,
    ‘type’ => $point_type,
    ‘entry’ => $entry,
    ‘data’ => $data,
    ‘token’ => $token,
    ‘host’ => $host
    )
    );

    $raw_response = wp_remote_post( $remote_url, $request );

    $response = ”;
    if ( ! is_wp_error( $raw_response ) && ( $raw_response[‘response’][‘code’] == 200 ) )
    $response = maybe_unserialize( $raw_response[‘body’] );

    echo ‘TEST’ . $response;

    [/insert_php]

Viewing 2 replies - 1 through 2 (of 2 total)