2014-12-03 3 views
2

Paypal REST api (java)를 사용하여 반복 가입을 수행하고 있습니다.Paypal REST API - 계약이 취소 되었습니까?

흐름은 다음과 같습니다, 그리고 노력 :

  • 내가 내가 내가 계약을 만든 계획 (확인)
  • (확인)
  • 를 활성화 플랜 (확인)
  • 을 생성
  • 내가 승인 링크 (확인)를 사용하여 페이팔로 사용자를 리디렉션
  • 페이팔
  • 내 사이트 (확인)
  • 내가 (확인) 계약을 실행할 수 다시 사용자를 리디렉션

나는 구매자로서 페이팔에 로그인하여 언제든지 계약을 수동으로 취소 할 수 있음을 알았습니다.

문제 : 판매자로

는, 그 구매자 x는 '지불 대시 보드를 반복 프로필>'에서 자신의 계약을 취소 볼 수 있지만 어떻게 코드를 사용하여이 정보를 조회 할 수 있습니다? 계약 ID가 있다고 가정합니다. Agreement 객체를 제공하는 정보는 없습니다.

올바른 방향으로 알려주십시오. 감사합니다

UPDATE :

내 계약 개체는 다음과 같습니다

:

{ 
    "id": "I-HLK83FVHB5X2", 
    "description": "item name goes here", 
    "start_date": "2014-12-04T05:00:00Z", 
    "plan": { 
    "payment_definitions": [ 
     { 
     "type": "TRIAL", 
     "frequency_interval": "3", 
     "frequency": "Month", 
     "cycles": "1", 
     "amount": { 
      "currency": "CAD", 
      "value": "900.00" 
     }, 
     "charge_models": [ 
      { 
      "type": "TAX", 
      "amount": { 
       "currency": "CAD", 
       "value": "11.11" 
      } 
      }, 
      { 
      "type": "SHIPPING", 
      "amount": { 
       "currency": "CAD", 
       "value": "0.00" 
      } 
      } 
     ] 
     }, 
     { 
     "type": "REGULAR", 
     "frequency_interval": "1", 
     "frequency": "Month", 
     "cycles": "0", 
     "amount": { 
      "currency": "CAD", 
      "value": "300.00" 
     }, 
     "charge_models": [ 
      { 
      "type": "TAX", 
      "amount": { 
       "currency": "CAD", 
       "value": "22.22" 
      } 
      }, 
      { 
      "type": "SHIPPING", 
      "amount": { 
       "currency": "CAD", 
       "value": "0.00" 
      } 
      } 
     ] 
     } 
    ], 
    "merchant_preferences": { 
     "setup_fee": { 
     "currency": "CAD", 
     "value": "0.00" 
     }, 
     "max_fail_attempts": "0", 
     "auto_bill_amount": "YES" 
    } 
    }, 
    "links": [ 
    { 
     "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/suspend", 
     "rel": "suspend", 
     "method": "POST" 
    }, 
    { 
     "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/re-activate", 
     "rel": "re_activate", 
     "method": "POST" 
    }, 
    { 
     "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/cancel", 
     "rel": "cancel", 
     "method": "POST" 
    }, 
    { 
     "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/bill-balance", 
     "rel": "self", 
     "method": "POST" 
    }, 
    { 
     "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-HLK83FVHB5X2/set-balance", 
     "rel": "self", 
     "method": "POST" 
    } 
    ] 
} 

답변

1

당신이 두 가지 옵션 1 : 설치 페이팔 IPN (즉시 지불 통지를) 그들이 당신을 알릴 수 있도록 수신 계약이 취소 된 경우.

2 : https://developer.paypal.com/docs/api/#retrieve-an-agreement 에서 언급 그것은 내가이 "상태", "agreement_details", "cycle_remaining"모든이없는이

 { 
     "id": "I-0LN988D3JACS", 
     "state": "Pending", 
     "description": "New Description", 
     "plan": { 
     "payment_definitions": [ 
      { 
      "type": "REGULAR", 
      "frequency": "Month", 
      "amount": { 
       "currency": "USD", 
       "value": "100.00" 
      }, 
      "charge_models": [ 
       { 
       "type": "TAX", 
       "amount": { 
        "currency": "USD", 
        "value": "12.00" 
       } 
       }, 
       { 
       "type": "SHIPPING", 
       "amount": { 
        "currency": "USD", 
        "value": "10.00" 
       } 
       } 
      ], 
      "cycles": "12", 
      "frequency_interval": "2" 
      } 
     ], 
     "merchant_preferences": { 
      "setup_fee": { 
      "currency": "USD", 
      "value": "0.00" 
      }, 
      "max_fail_attempts": "0", 
      "auto_bill_amount": "YES" 
     } 
     }, 
     "links": [ 
     { 
      "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS/suspend", 
      "rel": "suspend", 
      "method": "POST" 
     }, 
     { 
      "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS/re-activate", 
      "rel": "re_activate", 
      "method": "POST" 
     }, 
     { 
      "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS/cancel", 
      "rel": "cancel", 
      "method": "POST" 
     }, 
     { 
      "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS/bill-balance", 
      "rel": "self", 
      "method": "POST" 
     }, 
     { 
      "href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-0LN988D3JACS/set-balance", 
      "rel": "self", 
      "method": "POST" 
     } 
     ], 
     "start_date": "2015-02-19T08:00:00Z", 
     "agreement_details": { 
     "outstanding_balance": { 
      "currency": "USD", 
      "value": "0.00" 
     }, 
     "cycles_remaining": "12", 
     "cycles_completed": "0", 
     "final_payment_date": "2016-12-19T10:00:00Z", 
     "failed_payment_count": "0" 
     } 
     } 
+0

처럼은 응답 줄 것이다로서 당신은 항상 계약의 세부 정보를 검색 할 수 있습니다, 내 질문에 업데이트 된 참조하십시오. –

+0

이 질문에 대한 대답은 Paypal REST API에 관한 것이지만이 답변은 Paypal NVP/SOAP API를 고려하고 있습니다. – fiatjaf