phpjavascriptfacebookcredits

facebook, credits payment process error, how to?


I implement the example from facebook credits, and create an test app, added the callback.php in the Callback Url, place my keys correctly. but I get this error:

Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again.

I am trying to create a few buttons with different monetary values. Like:

Click to get 100 credits
Click to get 1000 credits

If I use this generic code, I get the payment window just fine, but I can't see my products there, I can only choose from already made presets :

function buyMore(){
    // calling the API ...
    var obj = {
        app_id: 'xxxxxxxxxxxxxxxxxxxxx',
        method: 'pay',
        order_info: n, 
        purchase_type: 'item',
        credits_purchase: true
    };

to show the user my monetary presets I think I need to pass different values to the function:

<p><a onclick="buyMore('100'); return false;">Buy More Credits 100</a></p>
<p><a onclick="buyMore('1000'); return false;">Buy More Credits 1000</a></p>


function buyMore(price) {
    var order_info = { 
        "title":'title',
        "description":'description',
        "price":price,
        "image_url":'http://....img_url',
        "product_url":'http://....product_url'
    };

    // calling the API ...
    var obj = {
        app_id: '153230661424821',
        method: 'pay',
        order_info: order_info,
        purchase_type: 'item'
    };
}

Not sure if I got it right.

Can anyone push me in the right direction?


Solution

  • Yeah, you'll have to have your users select the item they want to purchase, which will then call the buyMore function to have them confirm their purchase via the Credits dialog (like you're doing in your second example).

    First thing I'd do is check my Credits setting in the Developer app though. I've gotten that error before on a new app before realizing I'd forgotten to set my credits callback URL or set my user as a Credits test user.