This might be confusing as the payment_gateway variable doesn't hold a PaymentGateway object but a CommunityPaymentGateway object.