2011년 10월 3일 월요일

페이스북 크레디트 API

http://developers.facebook.com/docs/creditsapi/

번역중..




Every credits-enabled application has a callback URL that was defined in your application settings.
모든 크레디트 가능한 애플리케이션은 애플리케이션 셋팅이 가능한 콜백 URL이 있다.
Facebook will call this page after a user has clicked on the Facebook Credits button in your application.
페이스북은 유저가 페이스북에서 당신 애플리케이션의 크레디트 버튼을 누른 뒤에 이 페이지를 호출한다.
A significant amount of logic must be coded into your callback to handle multiple communications between Facebook and your application.
확실한 로직의 논리적인 총량은 반드시 너의 콜백 다양한 대화가 너의 애플리케이션과 페이스북 사이에 있어야 된다.

When Facebook receives a request - such as a pay request - we will call your callback URL and pass back the method name "payments_get_items" along with any information you passed in the order_info field.
페이스북이 요청을 받았을때 - 지불 요청 같은 - 우리는 당신이 order_info 필드에서 넘겨준 어떤 정보사이에서 당신의 callback URL을 호출하고 "payments_get_items" 메소드를 넘겨준다.

All of the information passed between Facebook and your callback URL will be JSON-encoded so you will have to decode before parsing.
페이스북과 당신의 콜백 URL 사이에서 오고가는 모든 정보는 JSON-encoded 화 되며 당신은 이것을 사용하기 전에 디코딩해야 합니다.

Your callback should have a conditional that parses out to POST variable called 'method'.
당신의 콜백 함수는 'method'라 불리는 POST 변수를 설명할 수 있는 조건을 가지고 있어야 한다.
If it sees "payments_get_items", it should then parse out the POST variable called 'order_info' and get the values you passed to Facebook originally.
만약 "payments_get_items" 가 보인다면 그것은 POST 변수 'order_info' 그리고 가치를  페이스북 그 자체를


Do a lookup in your database for that product_id and pull the item_title, item_description, price, product_url, and image_url to populate those respective fields.
당신의 DB를 위해 product_id, item_title, item_description, price, product_url, image_url 을 관심을 끌기 위한 필드..


After this is passed back, Facebook will display the dialog popup with the accompanying item information along with a "Confirm" or "Cancel" button.
이 모든 것들이 지나간 뒤에 페이스북은 컨펌 또는 캔슬 버튼과 함께 아이템 정보를 가진 다이얼로그 팝업을 띄운다.

If the buyer clicks "Confirm", Facebook will call your same callback URL and return "payments_status_update" with a status set to "placed", an order number, and the item information.
만약 구매자가 컨펌을 누른다면 페이스북은 당신의 같은 콜백 URL로 주문번호와 아이템 정보, "payments_status_update" 과 "placed" 로 상태를 세트한 상태로 돌려준다.

Your callback program should once again parse out the POST variable called 'method' and branch to logic based on the "payments_status_update" method.
당신의 콜백 프로그램은 다시 한번 'method' 라 불리는 POST 변수와 "payments_status_update" method에 기반한 로직에서 뻣어나간 가지를 파싱해야 한다.

In your logic for this method call, you should also parse out "status" and "order_id".
메서드 콜을 위한 당신의 로직에서 당신은 "status" 와 "order_id" 를 파싱해야 된다.

Check to make sure the "status" is "placed". If so, then set a next_state = "settled" which you will pass back to Facebook. You MUST also passback the method name and the order_id.
"status" 가 "placed" 가 되었다고 체크되었다. 만약 그래서 next_state = "settled"로 되었다면 당신은 페이스북에 넘겨주어야 한다. 당신은 반드시 메서드 네임과 order_id 만을 넘겨야 한다.

Facebook will then execute the transaction to capture any funds from the buyer to fill their Credits balance, and then move the appropriate number of Credits from their balance to your account.
페이스북은 크레디트 밸런스를 작성하기 위해 모든 자금흐름을 실행해야 할것이다. 그리고나서 적절한 크레디트 숫자를 당신 계정의 밸런스로 옮길 것이다.

When this has been completed, Facebook will once again callback to your callback URL with the method "payments_status_update" and the "status" variable set to "settled".
이것이 완료되면 페이스북은 다시 한번 콜백 URL을 호출해 "payments_status_update" 와 "status" 변수를 "settled" 로 바꾸어 넘겨준다.
This is when you will definitively know that the transaction was completed successfully and you can then perform any operations to give the item to the user.
이것이 완료되어 완벽히 성공적이 되면 당신은 유저에게 아이템을 넘겨주는 액션을 취하면 된다.

Please refer to the Application Callback section for more details.
참조에 관해서..

You can also view the Credits Sample App callback.php at Github.
당신은..

P.S: 혹시 페이스북 크레디트 과정 막히면 제게 문의주세요. 대답해드릴게요. 이 포스트 업데이트 해야 되는데 시간이 없네요. 그외 앱에 관련한 문의도 받아요~~

댓글 없음:

댓글 쓰기